diff options
author | Scott Moser <smoser@ubuntu.com> | 2014-07-21 14:33:27 -0400 |
---|---|---|
committer | Scott Moser <smoser@ubuntu.com> | 2014-07-21 14:33:27 -0400 |
commit | 0dbd2a0ec71de2f9d8d631ae5241a948fc6a51ee (patch) | |
tree | 658d3a3d0e2675a1738d65cc1260f2594877c360 /cloudinit/sources/DataSourceSmartOS.py | |
parent | f9d18e2ed747a6d44e60547fbcc0bbff780f351f (diff) | |
parent | 6a4976e8a9915680fbc91f90bed8fcfa79cba5cf (diff) | |
download | vyos-cloud-init-0dbd2a0ec71de2f9d8d631ae5241a948fc6a51ee.tar.gz vyos-cloud-init-0dbd2a0ec71de2f9d8d631ae5241a948fc6a51ee.zip |
merge from trunk
Diffstat (limited to 'cloudinit/sources/DataSourceSmartOS.py')
-rw-r--r-- | cloudinit/sources/DataSourceSmartOS.py | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/cloudinit/sources/DataSourceSmartOS.py b/cloudinit/sources/DataSourceSmartOS.py index 7c1eb09a..65ec0339 100644 --- a/cloudinit/sources/DataSourceSmartOS.py +++ b/cloudinit/sources/DataSourceSmartOS.py @@ -170,8 +170,9 @@ class DataSourceSmartOS(sources.DataSource): md = {} ud = "" - if not os.path.exists(self.seed): - LOG.debug("Host does not appear to be on SmartOS") + if not device_exists(self.seed): + LOG.debug("No serial device '%s' found for SmartOS datasource", + self.seed) return False uname_arch = os.uname()[4] @@ -274,6 +275,11 @@ class DataSourceSmartOS(sources.DataSource): b64=b64) +def device_exists(device): + """Symplistic method to determine if the device exists or not""" + return os.path.exists(device) + + def get_serial(seed_device, seed_timeout): """This is replaced in unit testing, allowing us to replace serial.Serial with a mocked class. |