Skip to content

Commit

Permalink
Dev: ra: Refine RAInfo.params interface to exclude some completion re…
Browse files Browse the repository at this point in the history
…sults
  • Loading branch information
liangxin1300 committed Jul 9, 2024
1 parent e9d76d6 commit 1ac113d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 9 deletions.
10 changes: 2 additions & 8 deletions crmsh/ra.py
Original file line number Diff line number Diff line change
Expand Up @@ -377,20 +377,14 @@ def mk_ra_node(self):
self.broken_ra = False
return self.ra_elem

def params(self, completion=False):
def params(self):
'''
Construct a dict of dicts: parameters are keys and
dictionary of attributes/values are values. Cached too.
completion:
If true, filter some (advanced) parameters out.
'''
if completion:
if self.mk_ra_node() is None:
return None
return [c.get("name")
for c in self.ra_elem.xpath("//parameters/parameter")
if c.get("name") and c.get("name") not in self.excluded_from_completion]
ident = "ra_params-%s" % self
if cache.is_cached(ident):
return cache.retrieve(ident)
Expand All @@ -399,7 +393,7 @@ def params(self, completion=False):
d = {}
for c in self.ra_elem.xpath("//parameters/parameter"):
name = c.get("name")
if not name:
if not name or name in self.excluded_from_completion:
continue
required = c.get("required") if not (c.get("deprecated") or c.get("obsoletes")) else "0"
unique = c.get("unique")
Expand Down
2 changes: 1 addition & 1 deletion crmsh/ui_configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ def _prim_params_completer(agent, args):
if command.sort_completion_inst is not None:

Check warning on line 234 in crmsh/ui_configure.py

View check run for this annotation

Codecov / codecov/patch

crmsh/ui_configure.py#L234

Added line #L234 was not covered by tests
# Set the value to 0 to use the costum sort order
command.sort_completion_inst.value = 0
return utils.filter_keys(agent.params(completion=True), args)
return utils.filter_keys(agent.params(), args)

Check warning on line 237 in crmsh/ui_configure.py

View check run for this annotation

Codecov / codecov/patch

crmsh/ui_configure.py#L236-L237

Added lines #L236 - L237 were not covered by tests


def _prim_meta_completer(agent, args):
Expand Down

0 comments on commit 1ac113d

Please sign in to comment.