summaryrefslogtreecommitdiff
path: root/cloudinit/sources/DataSourceSmartOS.py
diff options
context:
space:
mode:
authorDaniel Watkins <daniel.watkins@canonical.com>2015-03-25 15:54:14 +0000
committerDaniel Watkins <daniel.watkins@canonical.com>2015-03-25 15:54:14 +0000
commit1828ac3fa151ec7ff761b34305ed5fb85a9020d1 (patch)
tree74c8e3d3f87b51523dc7db1170f3a0527f26a226 /cloudinit/sources/DataSourceSmartOS.py
parent7b8b62490303928aa4d68271fdd73b2e9712c504 (diff)
downloadvyos-cloud-init-1828ac3fa151ec7ff761b34305ed5fb85a9020d1.tar.gz
vyos-cloud-init-1828ac3fa151ec7ff761b34305ed5fb85a9020d1.zip
Add logging to JoyentMetadataClient.
Diffstat (limited to 'cloudinit/sources/DataSourceSmartOS.py')
-rw-r--r--cloudinit/sources/DataSourceSmartOS.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/cloudinit/sources/DataSourceSmartOS.py b/cloudinit/sources/DataSourceSmartOS.py
index 694a011a..61dd044f 100644
--- a/cloudinit/sources/DataSourceSmartOS.py
+++ b/cloudinit/sources/DataSourceSmartOS.py
@@ -335,17 +335,23 @@ class JoyentMetadataClient(object):
'Request ID mismatch (expected: {0}; got {1}).'.format(
expected_request_id, frame_data['request_id']))
if not frame_data.get('payload', None):
+ LOG.info('No value found.')
return None
- return util.b64d(frame_data['payload'])
+ value = util.b64d(frame_data['payload'])
+ LOG.info('Value "%s" found.', value)
+ return value
def get_metadata(self, metadata_key):
+ LOG.info('Fetching metadata key "%s"...', metadata_key)
request_id = '{0:08x}'.format(random.randint(0, 0xffffffff))
message_body = '{0} GET {1}'.format(request_id,
util.b64e(metadata_key))
msg = 'V2 {0} {1} {2}\n'.format(
len(message_body), self._checksum(message_body), message_body)
+ LOG.debug('Writing "%s" to serial port.', msg)
self.serial.write(msg.encode('ascii'))
response = self.serial.readline().decode('ascii')
+ LOG.debug('Read "%s" from serial port.', response)
return self._get_value_from_frame(request_id, response)