← Back to team overview

cloud-init-dev team mailing list archive

[Merge] ~smoser/cloud-init:bug/lp1538522-azure-builtin-agent into cloud-init:master

 

Scott Moser has proposed merging ~smoser/cloud-init:bug/lp1538522-azure-builtin-agent into cloud-init:master.

Requested reviews:
  cloud init development team (cloud-init-dev)
Related bugs:
  Bug #1538522 in cloud-init: "Calls "service walinuxagent start" in Azure data source"
  https://bugs.launchpad.net/cloud-init/+bug/1538522

For more details, see:
https://code.launchpad.net/~smoser/cloud-init/+git/cloud-init/+merge/310432
-- 
Your team cloud init development team is requested to review the proposed merge of ~smoser/cloud-init:bug/lp1538522-azure-builtin-agent into cloud-init:master.
diff --git a/cloudinit/sources/DataSourceAzure.py b/cloudinit/sources/DataSourceAzure.py
index b802b03..8b9ccd6 100644
--- a/cloudinit/sources/DataSourceAzure.py
+++ b/cloudinit/sources/DataSourceAzure.py
@@ -38,13 +38,14 @@ LOG = logging.getLogger(__name__)
 DS_NAME = 'Azure'
 DEFAULT_METADATA = {"instance-id": "iid-AZURE-NODE"}
 AGENT_START = ['service', 'walinuxagent', 'start']
+AGENT_START_BUILTIN = "__builtin__"
 BOUNCE_COMMAND = [
     'sh', '-xc',
     "i=$interface; x=0; ifdown $i || x=$?; ifup $i || x=$?; exit $x"
 ]
 
 BUILTIN_DS_CONFIG = {
-    'agent_command': AGENT_START,
+    'agent_command': AGENT_START_BUILTIN,
     'data_dir': "/var/lib/waagent",
     'set_hostname': True,
     'hostname_bounce': {
@@ -229,7 +230,7 @@ class DataSourceAzureNet(sources.DataSource):
         # the directory to be protected.
         write_files(ddir, files, dirmode=0o700)
 
-        if self.ds_cfg['agent_command'] == '__builtin__':
+        if self.ds_cfg['agent_command'] == AGENT_START_BUILTIN:
             metadata_func = partial(get_metadata_from_fabric,
                                     fallback_lease_file=self.
                                     dhclient_lease_file)