Esempio n. 1
0
 def ensure_not_incompatible(self, checked, incompatible):
     if not checked in self._defined_options:
         return
     disallowed = self._defined_options & set(incompatible)
     if disallowed:
         raise CmdLineInputError("'{}' cannot be used with {}".format(
             checked, format_list(sorted(disallowed))))
Esempio n. 2
0
 def ensure_only_supported(self, *supported_options):
     unsupported_options = (
         # --debug is supported in all commands
         self._defined_options - set(supported_options) - set(["--debug"]))
     if unsupported_options:
         raise CmdLineInputError(
             "Specified options {} are not supported in this command".
             format(format_list(list(unsupported_options))))
Esempio n. 3
0
def booth_config_accepted_by_node(info):
    desc = ""
    if info["name_list"] and info["name_list"] not in [["booth"]]:
        desc = "{_s} {_list}".format(
            _s=("s" if len(info["name_list"]) > 1 else ""),
            _list=format_list(info["name_list"]))
    return "{_node_info}Booth config{_desc} saved".format(
        _node_info=format_optional(info["node"], "{0}: "),
        _desc=desc,
    )
Esempio n. 4
0
def booth_config_accepted_by_node(info):
    desc = ""
    if info["name_list"] and info["name_list"] not in [["booth"]]:
        desc = "{_s} {_list}".format(
            _s=("s" if len(info["name_list"]) > 1 else ""),
            _list=format_list(info["name_list"])
        )
    return "{_node_info}Booth config{_desc} saved".format(
        _node_info=format_optional(info["node"], "{0}: "),
        _desc=desc,
    )
Esempio n. 5
0
 def ensure_only_supported(self,
                           *supported_options,
                           hint_syntax_changed=False):
     unsupported_options = (
         # --debug is supported in all commands
         self._defined_options - set(supported_options) - set(["--debug"]))
     if unsupported_options:
         raise CmdLineInputError(
             "Specified options {} are not supported in this command".
             format(format_list(sorted(unsupported_options))),
             # Print error messages which point users to the changes section
             # in pcs manpage.
             # To be removed in the next significant version.
             hint=(HINT_SYNTAX_CHANGE if hint_syntax_changed else None))
Esempio n. 6
0
 def ensure_not_mutually_exclusive(self, *mutually_exclusive):
     options_to_report = self._defined_options & set(mutually_exclusive)
     if len(options_to_report) > 1:
         raise CmdLineInputError("Only one of {} can be used".format(
             format_list(sorted(options_to_report))))