Skip to content

Commit e35107a

Browse files
committed
slcli virtual list now lists users/passwords for all known software (softlayer#719)
1 parent 6c63d74 commit e35107a

4 files changed

Lines changed: 24 additions & 4 deletions

File tree

SoftLayer/CLI/virt/detail.py

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,9 +90,19 @@ def cli(env, identifier, passwords=False, price=False):
9090
result['billingItem']['recurringFee']])
9191

9292
if passwords:
93-
pass_table = formatting.Table(['username', 'password'])
94-
for item in result['operatingSystem']['passwords']:
95-
pass_table.add_row([item['username'], item['password']])
93+
pass_table = formatting.Table(['software', 'username', 'password'])
94+
95+
for component in result['softwareComponents']:
96+
for item in component['passwords']:
97+
pass_table.add_row([
98+
utils.lookup(component,
99+
'softwareLicense',
100+
'softwareDescription',
101+
'name'),
102+
item['username'],
103+
item['password'],
104+
])
105+
96106
table.add_row(['users', pass_table])
97107

98108
table.add_row(['tags', formatting.tags(result['tagReferences'])])

SoftLayer/fixtures/SoftLayer_Virtual_Guest.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,11 @@
4040
'softwareDescription': {'version': '12.04-64 Minimal for VSI',
4141
'name': 'Ubuntu'}}
4242
},
43+
'softwareComponents': [{
44+
'passwords': [{'username': 'user', 'password': 'pass'}],
45+
'softwareLicense': {
46+
'softwareDescription': {'name': 'Ubuntu'}}
47+
}],
4348
'tagReferences': [{'tag': {'name': 'production'}}],
4449
}
4550

SoftLayer/managers/vs.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,9 @@ def get_instance(self, instance_id, **kwargs):
200200
'blockDevices',
201201
'blockDeviceTemplateGroup[id, name, globalIdentifier]',
202202
'postInstallScriptUri',
203+
'''softwareComponents[
204+
passwords[username,password,notes],
205+
softwareLicense[softwareDescription[name]]]''',
203206
'''operatingSystem[passwords[username,password],
204207
softwareLicense.softwareDescription[
205208
manufacturer,name,version,

tests/CLI/modules/vs_tests.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,9 @@ def test_detail_vs(self):
6161
'public_ip': '172.16.240.2',
6262
'state': 'RUNNING',
6363
'status': 'ACTIVE',
64-
'users': [{'password': 'pass', 'username': 'user'}],
64+
'users': [{'software': 'Ubuntu',
65+
'password': 'pass',
66+
'username': 'user'}],
6567
'vlans': [{'type': 'PUBLIC',
6668
'number': 23,
6769
'id': 1}],

0 commit comments

Comments
 (0)