diff options
author | Ćukasz 'sil2100' Zemczak <lukasz.zemczak@ubuntu.com> | 2017-09-04 10:27:07 +0200 |
---|---|---|
committer | usd-importer <ubuntu-server@lists.ubuntu.com> | 2017-09-04 09:38:24 +0000 |
commit | 185ceb32fea5d5c2a43d7b6ee2a40228489055f4 (patch) | |
tree | 2e1c9cc42510c4a922cf63fa265ec0e1945ec14b /azurelinuxagent/common/conf.py | |
parent | 43bdf9debe5377216aed0086bff2aad864f6ba82 (diff) | |
download | vyos-walinuxagent-185ceb32fea5d5c2a43d7b6ee2a40228489055f4.tar.gz vyos-walinuxagent-185ceb32fea5d5c2a43d7b6ee2a40228489055f4.zip |
Import patches-unapplied version 2.2.16-0ubuntu1 to ubuntu/artful-proposed
Imported using git-ubuntu import.
Changelog parent: 43bdf9debe5377216aed0086bff2aad864f6ba82
New changelog entries:
* New upstream release (LP: #1714299).
Diffstat (limited to 'azurelinuxagent/common/conf.py')
-rw-r--r-- | azurelinuxagent/common/conf.py | 84 |
1 files changed, 83 insertions, 1 deletions
diff --git a/azurelinuxagent/common/conf.py b/azurelinuxagent/common/conf.py index 5422784..75a0248 100644 --- a/azurelinuxagent/common/conf.py +++ b/azurelinuxagent/common/conf.py @@ -85,12 +85,81 @@ def load_conf_from_file(conf_file_path, conf=__conf__): raise AgentConfigError(("Failed to load conf file:{0}, {1}" "").format(conf_file_path, err)) +__SWITCH_OPTIONS__ = { + "OS.AllowHTTP" : False, + "OS.EnableFirewall" : False, + "OS.EnableFIPS" : False, + "OS.EnableRDMA" : False, + "OS.UpdateRdmaDriver" : False, + "OS.CheckRdmaDriver" : False, + "Logs.Verbose" : False, + "Provisioning.Enabled" : True, + "Provisioning.UseCloudInit" : False, + "Provisioning.AllowResetSysUser" : False, + "Provisioning.RegenerateSshHostKeyPair" : False, + "Provisioning.DeleteRootPassword" : False, + "Provisioning.DecodeCustomData" : False, + "Provisioning.ExecuteCustomData" : False, + "Provisioning.MonitorHostName" : False, + "DetectScvmmEnv" : False, + "ResourceDisk.Format" : False, + "DetectScvmmEnv" : False, + "ResourceDisk.Format" : False, + "ResourceDisk.EnableSwap" : False, + "AutoUpdate.Enabled" : True, + "EnableOverProvisioning" : False +} + +__STRING_OPTIONS__ = { + "Lib.Dir" : "/var/lib/waagent", + "DVD.MountPoint" : "/mnt/cdrom/secure", + "Pid.File" : "/var/run/waagent.pid", + "Extension.LogDir" : "/var/log/azure", + "OS.OpensslPath" : "/usr/bin/openssl", + "OS.SshDir" : "/etc/ssh", + "OS.HomeDir" : "/home", + "OS.PasswordPath" : "/etc/shadow", + "OS.SudoersDir" : "/etc/sudoers.d", + "OS.RootDeviceScsiTimeout" : None, + "Provisioning.SshHostKeyPairType" : "rsa", + "Provisioning.PasswordCryptId" : "6", + "HttpProxy.Host" : None, + "ResourceDisk.MountPoint" : "/mnt/resource", + "ResourceDisk.MountOptions" : None, + "ResourceDisk.Filesystem" : "ext3", + "AutoUpdate.GAFamily" : "Prod" +} + +__INTEGER_OPTIONS__ = { + "Provisioning.PasswordCryptSaltLength" : 10, + "HttpProxy.Port" : None, + "ResourceDisk.SwapSizeMB" : 0, + "Autoupdate.Frequency" : 3600 +} + +def get_configuration(conf=__conf__): + options = {} + for option in __SWITCH_OPTIONS__: + options[option] = conf.get_switch(option, __SWITCH_OPTIONS__[option]) + + for option in __STRING_OPTIONS__: + options[option] = conf.get(option, __STRING_OPTIONS__[option]) + + for option in __INTEGER_OPTIONS__: + options[option] = conf.get_int(option, __INTEGER_OPTIONS__[option]) + + return options + +def enable_firewall(conf=__conf__): + return conf.get_switch("OS.EnableFirewall", False) def enable_rdma(conf=__conf__): return conf.get_switch("OS.EnableRDMA", False) or \ conf.get_switch("OS.UpdateRdmaDriver", False) or \ conf.get_switch("OS.CheckRdmaDriver", False) +def enable_rdma_update(conf=__conf__): + return conf.get_switch("OS.UpdateRdmaDriver", False) def get_logs_verbose(conf=__conf__): return conf.get_switch("Logs.Verbose", False) @@ -151,6 +220,16 @@ def get_root_device_scsi_timeout(conf=__conf__): return conf.get("OS.RootDeviceScsiTimeout", None) def get_ssh_host_keypair_type(conf=__conf__): + keypair_type = conf.get("Provisioning.SshHostKeyPairType", "rsa") + if keypair_type == "auto": + ''' + auto generates all supported key types and returns the + rsa thumbprint as the default. + ''' + return "rsa" + return keypair_type + +def get_ssh_host_keypair_mode(conf=__conf__): return conf.get("Provisioning.SshHostKeyPairType", "rsa") def get_provision_enabled(conf=__conf__): @@ -239,4 +318,7 @@ def get_autoupdate_frequency(conf=__conf__): return conf.get_int("Autoupdate.Frequency", 3600) def get_enable_overprovisioning(conf=__conf__): - return conf.get_switch("EnableOverProvisioning", False)
\ No newline at end of file + return conf.get_switch("EnableOverProvisioning", False) + +def get_allow_http(conf=__conf__): + return conf.get_switch("OS.AllowHTTP", False) |