Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'configure show changed' includes deleted elements #470

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion crmsh/cibconfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -3223,14 +3223,16 @@ def filter_objects(self, filters):
obj_set = orderedset.oset([])
and_filter, and_set = False, None
for spec in filters:
if spec == "or":
if spec in ["or", "from_show"]:
continue
elif spec == "and":
and_filter, and_set = True, obj_set
obj_set = orderedset.oset([])
continue
if spec == "changed":
obj_set |= orderedset.oset(self.modified_elems())
if "from_show" in filters:
obj_set |= orderedset.oset(self.remove_queue)
elif spec.startswith("type:"):
obj_set |= orderedset.oset(self.get_elems_on_type(spec))
elif spec.startswith("tag:"):
Expand Down
2 changes: 2 additions & 0 deletions crmsh/ui_configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -551,6 +551,8 @@ def do_show(self, context, *args):
from .utils import obscure
osargs = [arg[8:] for arg in args if arg.startswith('obscure:')]
args = [arg for arg in args if not arg.startswith('obscure:')]
if "changed" in args:
args.append("from_show")
with obscure(osargs):
set_obj = mkset_obj(*args)
return set_obj.show()
Expand Down
1 change: 1 addition & 0 deletions test/testcases/commit
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ commit
filter "sed '/g1/s/p1/d1/'"
group g2 d3 d2
delete d2
show changed
commit
_test
verify
Expand Down
10 changes: 7 additions & 3 deletions test/testcases/commit.exp
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,14 @@ INFO: 24: modified colocation:cl1 from c1 to g1
.INP: filter "sed '/g1/s/p1/d1/'"
.INP: group g2 d3 d2
.INP: delete d2
.INP: show changed
primitive d2 Dummy
group g1 d1 p2
group g2 d3
.INP: commit
.INP: _test
.INP: verify
WARNING: 35: st: unknown attribute 'yoyo-meta'
WARNING: 36: st: unknown attribute 'yoyo-meta'
.INP: show
node node1 \
attributes mem=16G
Expand All @@ -70,5 +74,5 @@ order o1 inf: p3 g1
op_defaults op-options: \
timeout=2m
.INP: commit
INFO: 37: apparently there is nothing to commit
INFO: 37: try changing something first
INFO: 38: apparently there is nothing to commit
INFO: 38: try changing something first