Ejemplo n.º 1
0
    def get_help_strings(cls):
        """Get help strings."""
        # look up types
        co = Factory.get('Constants')()
        source_systems = co.fetch_constants(co.AuthoritativeSystem)
        contact_types = co.fetch_constants(co.ContactInfo)

        # Enrich cmd_args with actual constants.
        # TODO: Find a better way to do this for all similar cmd_args
        cmd_args = {}
        list_sep = '\n - '
        for k, v in CMD_ARGS.items():
            cmd_args[k] = v[:]
            if k == 'entity_contact_source_system':
                cmd_args[k][2] += '\nSource systems:'
                cmd_args[k][2] += list_sep + list_sep.join(six.text_type(c) for
                                                           c in source_systems)
            if k == 'entity_contact_type':
                cmd_args[k][2] += '\nContact types:'
                cmd_args[k][2] += list_sep + list_sep.join(six.text_type(c) for
                                                           c in contact_types)
        del co

        return merge_help_strings(
            ({}, {}, cmd_args),  # We want _our_ cmd_args to win!
            get_help_strings(),
            ({}, CMD_HELP, {}))
Ejemplo n.º 2
0
    def get_help_strings(cls):
        """Get help strings."""
        # look up types
        co = Factory.get('Constants')()
        source_systems = co.fetch_constants(co.AuthoritativeSystem)
        contact_types = co.fetch_constants(co.ContactInfo)

        # Enrich cmd_args with actual constants.
        # TODO: Find a better way to do this for all similar cmd_args
        cmd_args = {}
        list_sep = '\n - '
        for k, v in CMD_ARGS.items():
            cmd_args[k] = v[:]
            if k == 'entity_contact_source_system':
                cmd_args[k][2] += '\nSource systems:'
                cmd_args[k][2] += list_sep + list_sep.join(six.text_type(c) for
                                                           c in source_systems)
            if k == 'entity_contact_type':
                cmd_args[k][2] += '\nContact types:'
                cmd_args[k][2] += list_sep + list_sep.join(six.text_type(c) for
                                                           c in contact_types)
        del co

        return merge_help_strings(
            ({}, {}, cmd_args),  # We want _our_ cmd_args to win!
            get_help_strings(),
            ({}, CMD_HELP, {}))
Ejemplo n.º 3
0
    def get_help_strings(cls):
        """Get help strings."""
        group_help = {
            'history': "History related commands",
        }

        command_help = {
            'history': {
                'history_show': 'List changes made to an entity',
            }
        }

        argument_help = {
            'limit_number_of_results': [
                'limit', 'Number of changes to list',
                'Upper limit for how many changes to include, counting '
                'backwards from the most recent. Default (when left empty) '
                'is 0, which means no limit'
            ],
            'yes_no_all_changes': [
                'all', 'All involved changes?',
                'List all changes where the entity is involved (yes), or '
                'only the ones where the entity itself is changed (no)'
            ],
        }

        return merge_help_strings(
            get_help_strings(),
            (group_help, command_help, argument_help),
        )
Ejemplo n.º 4
0
 def get_help_strings(cls):
     """Help strings are used by jbofh to give users explanations for groups
     of commands, commands and all command arguments (parameters). The
     arg_help's keys are referencing to either Parameters' _help_ref (TODO:
     or its _type in addition?)"""
     return merge_help_strings(
         ({}, {}, HELP_DNS_ARGS),
         (HELP_POLICY_GROUP, HELP_POLICY_CMDS, HELP_POLICY_ARGS))
Ejemplo n.º 5
0
 def get_help_strings(cls):
     """Help strings are used by jbofh to give users explanations for groups
     of commands, commands and all command arguments (parameters). The
     arg_help's keys are referencing to either Parameters' _help_ref (TODO:
     or its _type in addition?)"""
     return merge_help_strings(
         ({}, {}, HELP_DNS_ARGS),
         (HELP_POLICY_GROUP, HELP_POLICY_CMDS, HELP_POLICY_ARGS))
Ejemplo n.º 6
0
 def get_help_strings(cls):
     const = Factory.get('Constants')()
     account_types = const.fetch_constants(const.Account)
     cmd_args = {}
     list_sep = '\n - '
     for key, value in CMD_ARGS.items():
         cmd_args[key] = value[:]
         if key == 'unpersonal_account_type':
             cmd_args[key][2] += '\nValid account types:'
             cmd_args[key][2] += list_sep + list_sep.join(
                 six.text_type(c) for c in account_types)
     del const
     return merge_help_strings(
         ({}, {}, cmd_args),  # We want _our_ cmd_args to win!
         get_help_strings(),
         ({}, CMD_HELP, {}))
Ejemplo n.º 7
0
 def get_help_strings(cls):
     cmds = {
         'misc': {
             'misc_list_legacy_user': '******',
         },
         'user': {
             'user_delete_permanent': 'Delete an account permanently',
         },
     }
     args = {
         'yes_no_sure': [
             'certain',
             'Are you absolutely certain you want to do this? This deletes'
             ' the account completely from the database and can not be'
             ' reversed. (y/n)'
         ]
     }
     return merge_help_strings(bofhd_core_help.get_help_strings(),
                               ({}, cmds, args))
Ejemplo n.º 8
0
 def get_help_strings(cls):
     email_cmds = {
         'email': {
             'email_forward_info':
                 "Show information about an address that is forwarded to",
             'email_move':
                 "Move a user's e-mail to another server",
             'email_show_reservation_status':
                 "Show reservation status for an account",
             "email_move_domain_addresses":
                 "Move the first account's e-mail addresses at a domain to "
                 "the second account",
         }
     }
     arg_help = {
         'yes_no_move_primary':
             ['move_primary',
              'Should primary email address be moved? (y/n)'],
     }
     return merge_help_strings(
         super(EmailCommands, cls).get_help_strings(),
         ({}, email_cmds, arg_help))
Ejemplo n.º 9
0
 def get_help_strings(cls):
     group, _, args = get_help_strings()
     # merge help strings will strip away unused groups
     return merge_help_strings((group, {}, args), ({}, CMD_HELP, {}))
Ejemplo n.º 10
0
 def get_help_strings(cls):
     return merge_help_strings(get_help_strings(),
                               ({}, HELP_CMDS, {}))
Ejemplo n.º 11
0
 def get_help_strings(cls):
     return merge_help_strings(
         super(EmailCommands, cls).get_help_strings(),
         ({}, HELP_EMAIL_CMDS, {}))
Ejemplo n.º 12
0
 def get_help_strings(cls):
     return merge_help_strings(
         super(BofhdExtension, cls).get_help_strings(),
         ({}, HELP_CMDS, {}))
Ejemplo n.º 13
0
 def get_help_strings(cls):
     """Get help strings."""
     return merge_help_strings(
         (HELP_GROUP, HELP_CMD, HELP_ARGS),
         get_help_strings())
 def get_help_strings(cls):
     _, _, args = get_help_strings()
     return merge_help_strings(
         ({}, {}, args),
         (HELP_SUBNET_GROUP, HELP_SUBNET_CMDS, HELP_SUBNET_ARGS))
Ejemplo n.º 15
0
 def get_help_strings(cls):
     """Definition of the help text for event-related commands."""
     _, _, args = get_help_strings()
     return merge_help_strings(
         ({}, {}, args),
         (HELP_EVENT_GROUP, HELP_EVENT_CMDS, HELP_EVENT_ARGS))
Ejemplo n.º 16
0
 def get_help_strings(cls):
     return merge_help_strings(
         super(BofhdExtension, cls).get_help_strings(), ({}, HELP_CMDS, {}))
Ejemplo n.º 17
0
 def get_help_strings(cls):
     return merge_help_strings(get_help_strings(), ({}, HELP_CMDS, {}))
Ejemplo n.º 18
0
 def get_help_strings(cls):
     return merge_help_strings(
         super(BofhdAccessCommands, cls).get_help_strings(),
         (HELP_ACCESS_GROUP, HELP_ACCESS_CMDS, HELP_ACCESS_ARGS))
Ejemplo n.º 19
0
 def get_help_strings(cls):
     return merge_help_strings(
         super(EmailCommands, cls).get_help_strings(),
         ({}, HELP_EMAIL_CMDS, {}))
Ejemplo n.º 20
0
 def get_help_strings(cls):
     group, _, args = get_help_strings()
     # merge help strings will strip away unused groups
     return merge_help_strings(
         (group, {}, args),
         ({}, CMD_HELP, {}))