summaryrefslogtreecommitdiff
path: root/cloudinit/sources
diff options
context:
space:
mode:
authorMike Gerdts <mike.gerdts@joyent.com>2018-04-20 20:30:44 -0400
committerScott Moser <smoser@brickies.net>2018-04-20 20:30:44 -0400
commit8e111502a0f9d437ff6045f1269c95e5756fc43b (patch)
treea36d599593f7df10c2bad069ed5f2ddab43866a6 /cloudinit/sources
parent5037252ca5dc54c6d978b23dba063ac5fabc98fa (diff)
downloadvyos-cloud-init-8e111502a0f9d437ff6045f1269c95e5756fc43b.tar.gz
vyos-cloud-init-8e111502a0f9d437ff6045f1269c95e5756fc43b.zip
DataSourceSmartOS: list() should always return a list
If customer_metadata has no keys, the KEYS request returns an empty string. Callers of the list() method expect a list to be returned and will give a stack trace if this expectation is not met. LP: #1763480
Diffstat (limited to 'cloudinit/sources')
-rw-r--r--cloudinit/sources/DataSourceSmartOS.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/cloudinit/sources/DataSourceSmartOS.py b/cloudinit/sources/DataSourceSmartOS.py
index c8998b40..d4386fec 100644
--- a/cloudinit/sources/DataSourceSmartOS.py
+++ b/cloudinit/sources/DataSourceSmartOS.py
@@ -455,9 +455,9 @@ class JoyentMetadataClient(object):
def list(self):
result = self.request(rtype='KEYS')
- if result:
- result = result.split('\n')
- return result
+ if not result:
+ return []
+ return result.split('\n')
def put(self, key, val):
param = b' '.join([base64.b64encode(i.encode())