diff options
Diffstat (limited to 'cloudinit/sources/DataSourceNoCloud.py')
-rw-r--r-- | cloudinit/sources/DataSourceNoCloud.py | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/cloudinit/sources/DataSourceNoCloud.py b/cloudinit/sources/DataSourceNoCloud.py index 596a96a7..8d9caa02 100644 --- a/cloudinit/sources/DataSourceNoCloud.py +++ b/cloudinit/sources/DataSourceNoCloud.py @@ -280,12 +280,23 @@ def load_cmdline_data(fill, cmdline=None): ("ds=nocloud-net", sources.DSMODE_NETWORK), ] for idstr, dsmode in pairs: - if parse_cmdline_data(idstr, fill, cmdline): + if not parse_cmdline_data(idstr, fill, cmdline): + continue + if "dsmode" in fill: # if dsmode was explicitly in the command line, then - # prefer it to the dsmode based on the command line id - if "dsmode" not in fill: - fill["dsmode"] = dsmode + # prefer it to the dsmode based on seedfrom type return True + + seedfrom = fill.get("seedfrom") + if seedfrom: + if seedfrom.startswith(("http://", "https://")): + fill["dsmode"] = sources.DSMODE_NETWORK + elif seedfrom.startswith(("file://", "/")): + fill["dsmode"] = sources.DSMODE_LOCAL + else: + fill["dsmode"] = dsmode + + return True return False |