Skip to content

Commit

Permalink
Merge pull request #1404 from nicholasyang2022/ui-context-ignore-requ…
Browse files Browse the repository at this point in the history
…iremnt-help

[crmsh-4.6] Dev: ui_context: ignore requirements when option --help is specified
  • Loading branch information
liangxin1300 authored Apr 25, 2024
2 parents 11e262d + 47a9ba0 commit c75d131
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 8 deletions.
3 changes: 2 additions & 1 deletion crmsh/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -512,5 +512,6 @@
RSC_ROLE_UNPROMOTED_LEGACY = "Slave"
PCMK_VERSION_DEFAULT = "2.0.0"

NON_FUNCTIONAL_COMMANDS = ('help', 'cd', 'ls', 'quit', 'up')
NON_FUNCTIONAL_COMMANDS = {'help', 'cd', 'ls', 'quit', 'up'}
NON_FUNCTIONAL_OPTIONS = {'--help', '--help-without-redirect'}
# vim:ts=4:sw=4:et:
3 changes: 2 additions & 1 deletion crmsh/ui_context.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,8 @@ def run(self, line):
cmd = True
break
if cmd:
if self.command_name not in constants.NON_FUNCTIONAL_COMMANDS:
if self.command_name not in constants.NON_FUNCTIONAL_COMMANDS\
and all(arg not in constants.NON_FUNCTIONAL_OPTIONS for arg in self.command_args):
entry = self.current_level()
if 'requires' in dir(entry) and not entry.requires():
self.fatal_error("Missing requirements")
Expand Down
2 changes: 0 additions & 2 deletions doc/toolchain/bin/adocxt
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ RE_SECTION_TITLE = re.compile('^=')
RE_FROM_CODE_OR_SECTION_TITLE=re.compile(r'^(?:\[\[([^,]+),[^,]*,From Code]]$|=)')

TAG_EXCLUDES = {
'cmdhelp_node_online',
'cmdhelp_node_standby',
'cmdhelp_root_report',
}

Expand Down
32 changes: 28 additions & 4 deletions doc/website-v1/man-4.6.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -2479,9 +2479,20 @@ maintenance [<node>]

[[cmdhelp_node_online,set node online,From Code]]
==== `online`
See "crm node help online" or "crm node online --help"
Usage:

online [--all | <node>... ]

Specify node(s) on which to online node. If no nodes are specified, online node on the local node. If --all is specified, online node on all nodes.

Options:

* `+++-h, --help+++`: Show this help message

* `+++--all+++`: To online node on all nodes



[[cmdhelp_node_ready,put node into ready mode]]
==== `ready`

Set the node's maintenance status to `off`. The node should be
Expand Down Expand Up @@ -2523,9 +2534,22 @@ show [<node>]

[[cmdhelp_node_standby,put node into standby,From Code]]
==== `standby`
See "crm node help standby" or "crm node standby --help"
Usage:

standby [--all | <node>... ] [lifetime]

Specify node(s) on which to standby node. If no nodes are specified, standby node on the local node. If --all is specified, standby node on all nodes.

Additionally, you may specify a lifetime for the standby---if set to "reboot", the node will be back online once it reboots. "forever" will keep the node in standby after reboot. The life time defaults to "forever".

Options:

* `+++-h, --help+++`: Show this help message

* `+++--all+++`: To standby node on all nodes



[[cmdhelp_node_status-attr,manage status attributes]]
==== `status-attr`

Edit node attributes which are in the CIB status section, i.e.,
Expand Down

0 comments on commit c75d131

Please sign in to comment.