Skip to content

Commit f4eae5a

Browse files
committed
[sunbeam] Add deployment commands
* Update some commands that now need a sunbeam_user * manifest show doesn't need --id any more * Move the cluster commands under the user Closes: #4037 Closes: #4038 Signed-off-by: Arif Ali <arif.ali@canonical.com>
1 parent 2b3346f commit f4eae5a

1 file changed

Lines changed: 35 additions & 15 deletions

File tree

sos/report/plugins/sunbeam.py

Lines changed: 35 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -44,21 +44,6 @@ def setup(self):
4444
'/var/snap/openstack/current/config.yaml',
4545
])
4646

47-
self.add_cmd_output([
48-
'sunbeam cluster list',
49-
'sunbeam cluster list --format yaml',
50-
'sunbeam manifest list',
51-
], snap_cmd=True)
52-
53-
manifest_raw = self.collect_cmd_output(
54-
'sunbeam manifest list --format yaml')
55-
56-
if manifest_raw['status'] == 0:
57-
manifests = yaml.safe_load(manifest_raw['output'])
58-
for manifest in manifests:
59-
self.add_cmd_output(
60-
f'sunbeam manifest show --id {manifest["manifestid"]}')
61-
6247
sunbeam_user = self.get_option("sunbeam-user")
6348
try:
6449
user_pwd = pwd.getpwnam(sunbeam_user)
@@ -71,12 +56,47 @@ def setup(self):
7156
return
7257

7358
if user_pwd:
59+
self.add_cmd_output([
60+
'sunbeam cluster list',
61+
'sunbeam cluster list --format yaml',
62+
'sunbeam manifest list',
63+
'sunbeam deployment list',
64+
], snap_cmd=True, runas=sunbeam_user)
65+
66+
manifest_raw = self.collect_cmd_output(
67+
'sunbeam manifest list --format yaml',
68+
runas=sunbeam_user
69+
)
70+
71+
if manifest_raw['status'] == 0:
72+
manifests = yaml.safe_load(manifest_raw['output'])
73+
for manifest in manifests:
74+
self.add_cmd_output(
75+
f'sunbeam manifest show {manifest["manifestid"]}',
76+
snap_cmd=True, runas=sunbeam_user
77+
)
78+
79+
deployment_raw = self.collect_cmd_output(
80+
'sunbeam deployment list --format yaml',
81+
runas=sunbeam_user
82+
)
83+
84+
if deployment_raw['status'] == 0:
85+
deployments = yaml.safe_load(deployment_raw['output'])
86+
for deployment in deployments['deployments']:
87+
self.add_cmd_output([
88+
f'sunbeam deployment show {deployment["name"]}',
89+
f'sunbeam deployment show {deployment["name"]} '
90+
'--format yaml',
91+
], snap_cmd=True, runas=sunbeam_user)
92+
7493
sb_snap_homedir = f'{user_pwd.pw_dir}/snap/openstack/common'
7594

7695
self.add_copy_spec([
7796
f"{sb_snap_homedir}/*.log",
7897
f"{sb_snap_homedir}/etc/*/*.log",
7998
f"{sb_snap_homedir}/logs/*.log",
99+
f"{sb_snap_homedir}/reports/*.yaml",
80100
])
81101

82102
if self.get_option("juju-allow-login"):

0 commit comments

Comments
 (0)