def test_ensure_rpm_root_idempotency(self):
        # Test
        structure.ensure_root(self.cli)
        returned_root_section = structure.ensure_root(self.cli)

        # Verify
        self.assertTrue(returned_root_section is not None)
        self.assertEqual(returned_root_section.name, structure.SECTION_ROOT)
        puppet_root_section = self.cli.find_section(structure.SECTION_ROOT)
        self.assertTrue(puppet_root_section is not None)
        self.assertEqual(puppet_root_section.name, structure.SECTION_ROOT)
Esempio n. 2
0
def initialize(context):
    root_section = structure.ensure_root(context.cli)
    consumer_description = _('register, bind, and interact with rpm consumers')
    consumer_section = root_section.create_subsection('consumer', consumer_description)

    # New subsections
    consumer_section.add_subsection(PackageSection(context))
    consumer_section.add_subsection(GroupSection(context))
    consumer_section.add_subsection(ErrataSection(context))

    m = 'binds a consumer to a repository'
    consumer_section.add_command(BindCommand(context, 'bind', _(m)))

    m = 'removes the binding between a consumer and a repository'
    consumer_section.add_command(UnbindCommand(context, 'unbind', _(m)))

    # consumer groups

    consumer_group_description = _('rpm consumer group commands')
    consumer_group_section = consumer_section.create_subsection('group', consumer_group_description)

    m = _('binds each consumer in a consumer group to a repository')
    consumer_group_section.add_command(
        ConsumerGroupBindCommand(context, 'bind', m))

    m = _('unbinds each consumer in a consumer group from a repository')
    consumer_group_section.add_command(
        ConsumerGroupUnbindCommand(context, 'unbind', m))

    # New subsections for group subsection
    consumer_group_section.add_subsection(ConsumerGroupPackageSection(context))
Esempio n. 3
0
def initialize(context):
    root_section = structure.ensure_root(context.cli)
    consumer_description = _('register, bind, and interact with rpm consumers')
    consumer_section = root_section.create_subsection('consumer', consumer_description)

    # Basic consumer commands
    consumer_section.add_command(basics.ListCommand(context))
    consumer_section.add_command(basics.UpdateCommand(context))
    consumer_section.add_command(basics.UnregisterCommand(context))
    consumer_section.add_command(basics.SearchCommand(context))
    consumer_section.add_command(basics.HistoryCommand(context))

    m = 'binds a consumer to a repository'
    consumer_section.add_command(BindCommand(context, 'bind', _(m)))

    m = 'removes the binding between a consumer and a repository'
    consumer_section.add_command(UnbindCommand(context, 'unbind', _(m)))

    # New subsections
    consumer_section.add_subsection(PackageSection(context))
    consumer_section.add_subsection(PackageGroupSection(context))
    consumer_section.add_subsection(ErrataSection(context))

    # Consumer groups
    consumer_group_description = _('consumer group commands')
    consumer_group_section = consumer_section.create_subsection('group', consumer_group_description)

    consumer_group_section.add_command(consumer_group_cudl.CreateConsumerGroupCommand(context))
    consumer_group_section.add_command(consumer_group_cudl.UpdateConsumerGroupCommand(context))
    consumer_group_section.add_command(consumer_group_cudl.DeleteConsumerGroupCommand(context))
    consumer_group_section.add_command(consumer_group_cudl.ListConsumerGroupsCommand(context))
    consumer_group_section.add_command(consumer_group_cudl.SearchConsumerGroupsCommand(context))

    m = _('binds each consumer in a consumer group to a repository')
    consumer_group_section.add_command(
        ConsumerGroupBindCommand(context, 'bind', m))

    m = _('unbinds each consumer in a consumer group from a repository')
    consumer_group_section.add_command(
        ConsumerGroupUnbindCommand(context, 'unbind', m))

    # Consumer group membership
    members_description = _('manage members of repository groups')
    members_section = consumer_group_section.create_subsection('members', members_description)

    members_section.add_command(consumer_group_members.ListConsumerGroupMembersCommand(context))
    members_section.add_command(consumer_group_members.AddConsumerGroupMembersCommand(context))
    members_section.add_command(consumer_group_members.RemoveConsumerGroupMembersCommand(context))

    # New subsections for group subsection
    consumer_group_section.add_subsection(ConsumerGroupPackageSection(context))