mgr/orch: increase readability for yaml representation#35537
mgr/orch: increase readability for yaml representation#35537sebastian-philipp merged 8 commits intoceph:masterfrom
Conversation
|
| out['version'] = self.version | ||
| out['status'] = self.status | ||
| out['status_desc'] = self.status_desc | ||
|
|
There was a problem hiding this comment.
maybe this form will be syntactically sweeter for you:
out = OrderedDict([
('hostname', self.hostname),
('container_id', self.container_id),
('container_image_id', self.container_image_id),
('container_image_name', self.container_image_name),
('daemon_id', self.daemon_id),
('daemon_type', self.daemon_type),
('version', self.version),
('status', self.status),
('status_desc', self.status_desc),
])
| empty = [k for k, v in out.items() if v is None] | ||
| for e in empty: | ||
| del out[e] |
There was a problem hiding this comment.
That's confusing, why not just use regular for?
for k,v in out.items():
if not v:
del out[k]
There was a problem hiding this comment.
No, as it will modify dictionary size during iteration.
There was a problem hiding this comment.
No, as it will modify dictionary size during iteration.
It should not be a problem, however, if you unsure, you can use only keys() and construct a list from it:
for k in list(out.keys()):
if not out[k]:
del out[k]
There was a problem hiding this comment.
yeah, that's what I'm doing here.
ba6f132 to
61032bb
Compare
|
jenkins test make check |
mind if I merge this as it is? otherwise I'll have to do another PR validation run for it. |
After you clarify on this change here: |
61032bb to
6515c3e
Compare
* Add test for new yaml representation Signed-off-by: Sebastian Wagner <sebastian.wagner@suse.com>
* Changes: An empty OSD Spec is now invalid. * OSDSpec.validate() now fails, if service-id is empty Signed-off-by: Sebastian Wagner <sebastian.wagner@suse.com>
Signed-off-by: Sebastian Wagner <sebastian.wagner@suse.com>
Signed-off-by: Sebastian Wagner <sebastian.wagner@suse.com>
Signed-off-by: Sebastian Wagner <sebastian.wagner@suse.com>
Signed-off-by: Sebastian Wagner <sebastian.wagner@suse.com>
Signed-off-by: Sebastian Wagner <sebastian.wagner@suse.com>
Signed-off-by: Sebastian Wagner <sebastian.wagner@suse.com>
6515c3e to
5150e95
Compare
| # Please do not modify those JSON values. | ||
|
|
||
| spec = ServiceSpec.from_json(spec_json) | ||
| # just some verification that we can sill read old octopus specs |
There was a problem hiding this comment.
Found a typo
| # just some verification that we can sill read old octopus specs | |
| # just some verification that we can still read old octopus specs |
|
jenkins test dashboard backend |
ceph orch ls --format=yamlbefore:after:
Fixes: https://tracker.ceph.com/issues/45321
Checklist
Show available Jenkins commands
jenkins retest this pleasejenkins test classic perfjenkins test crimson perfjenkins test signedjenkins test make checkjenkins test make check arm64jenkins test submodulesjenkins test dashboardjenkins test dashboard backendjenkins test docsjenkins render docsjenkins test ceph-volume alljenkins test ceph-volume tox