summaryrefslogtreecommitdiff
path: root/cloudinit/sources/DataSourceSmartOS.py
diff options
context:
space:
mode:
authorScott Moser <smoser@ubuntu.com>2014-06-02 16:56:31 -0400
committerScott Moser <smoser@ubuntu.com>2014-06-02 16:56:31 -0400
commit2bb228751a223f21296ff9166b42583c670359a5 (patch)
tree434918ba9bd4435047ebe9d6d5720c2b95dee269 /cloudinit/sources/DataSourceSmartOS.py
parent5067b44d18c1338520acd7ea7363371853edde6f (diff)
downloadvyos-cloud-init-2bb228751a223f21296ff9166b42583c670359a5.tar.gz
vyos-cloud-init-2bb228751a223f21296ff9166b42583c670359a5.zip
SmartOS test: do not require existance of /dev/ttyS1.
LP: #1316597
Diffstat (limited to 'cloudinit/sources/DataSourceSmartOS.py')
-rw-r--r--cloudinit/sources/DataSourceSmartOS.py10
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.