~smoser/cloud-init/systemd-enable

« back to all changes in this revision

Viewing changes to cloudinit/sources/DataSourceSmartOS.py

  • Committer: Scott Moser
  • Date: 2014-06-02 20:56:31 UTC
  • Revision ID: smoser@ubuntu.com-20140602205631-pl7nhr7vy9t07e09
SmartOS test: do not require existance of /dev/ttyS1.

Show diffs side-by-side

added added

removed removed

Lines of Context:
170
170
        md = {}
171
171
        ud = ""
172
172
 
173
 
        if not os.path.exists(self.seed):
174
 
            LOG.debug("Host does not appear to be on SmartOS")
 
173
        if not device_exists(self.seed):
 
174
            LOG.debug("No serial device '%s' found for SmartOS datasource",
 
175
                      self.seed)
175
176
            return False
176
177
 
177
178
        uname_arch = os.uname()[4]
274
275
                          b64=b64)
275
276
 
276
277
 
 
278
def device_exists(device):
 
279
    """Symplistic method to determine if the device exists or not"""
 
280
    return os.path.exists(device)
 
281
 
 
282
 
277
283
def get_serial(seed_device, seed_timeout):
278
284
    """This is replaced in unit testing, allowing us to replace
279
285
        serial.Serial with a mocked class.