summaryrefslogtreecommitdiff
path: root/cloudinit/sources/DataSourceExoscale.py
diff options
context:
space:
mode:
authorChad Smith <chad.smith@canonical.com>2019-08-28 00:58:16 +0000
committerServer Team CI Bot <josh.powers+server-team-bot@canonical.com>2019-08-28 00:58:16 +0000
commitd1b022217a652c7a84d5430c9e571987864d3982 (patch)
treeabf5e52bd4ede444f074e3fc7a48bad5a79730f8 /cloudinit/sources/DataSourceExoscale.py
parenta3926bffc985e5d39056858f65259a4ac438c037 (diff)
downloadvyos-cloud-init-d1b022217a652c7a84d5430c9e571987864d3982.tar.gz
vyos-cloud-init-d1b022217a652c7a84d5430c9e571987864d3982.zip
exoscale: fix sysconfig cloud_config_modules overrides
Make sure Exoscale supplements or overrides existing system config setting cloud_config_modules instead of replacing it with a one item list set-passords LP: #1841454
Diffstat (limited to 'cloudinit/sources/DataSourceExoscale.py')
-rw-r--r--cloudinit/sources/DataSourceExoscale.py26
1 files changed, 17 insertions, 9 deletions
diff --git a/cloudinit/sources/DataSourceExoscale.py b/cloudinit/sources/DataSourceExoscale.py
index 52e7f6f6..fdfb4ed3 100644
--- a/cloudinit/sources/DataSourceExoscale.py
+++ b/cloudinit/sources/DataSourceExoscale.py
@@ -6,6 +6,7 @@
from cloudinit import ec2_utils as ec2
from cloudinit import log as logging
from cloudinit import sources
+from cloudinit import helpers
from cloudinit import url_helper
from cloudinit import util
@@ -20,13 +21,6 @@ URL_RETRIES = 6
EXOSCALE_DMI_NAME = "Exoscale"
-BUILTIN_DS_CONFIG = {
- # We run the set password config module on every boot in order to enable
- # resetting the instance's password via the exoscale console (and a
- # subsequent instance reboot).
- 'cloud_config_modules': [["set-passwords", "always"]]
-}
-
class DataSourceExoscale(sources.DataSource):
@@ -42,8 +36,22 @@ class DataSourceExoscale(sources.DataSource):
self.ds_cfg.get('password_server_port', PASSWORD_SERVER_PORT))
self.url_timeout = self.ds_cfg.get('timeout', URL_TIMEOUT)
self.url_retries = self.ds_cfg.get('retries', URL_RETRIES)
-
- self.extra_config = BUILTIN_DS_CONFIG
+ self.extra_config = {}
+
+ def activate(self, cfg, is_new_instance):
+ """Adjust set-passwords module to run 'always' during each boot"""
+ # We run the set password config module on every boot in order to
+ # enable resetting the instance's password via the exoscale console
+ # (and a subsequent instance reboot).
+ # Exoscale password server only provides set-passwords user-data if
+ # a user has triggered a password reset. So calling that password
+ # service generally results in no additional cloud-config.
+ # TODO(Create util functions for overriding merged sys_cfg module freq)
+ mod = 'set_passwords'
+ sem_path = self.paths.get_ipath_cur('sem')
+ sem_helper = helpers.FileSemaphores(sem_path)
+ if sem_helper.clear('config_' + mod, None):
+ LOG.debug('Overriding module set-passwords with frequency always')
def wait_for_metadata_service(self):
"""Wait for the metadata service to be reachable."""