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)
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(YumConsumerBindCommand(context)) consumer_section.add_command(YumConsumerUnbindCommand(context)) # New subsections consumer_section.add_subsection(YumConsumerPackageSection(context)) consumer_section.add_subsection(YumConsumerPackageGroupSection(context)) consumer_section.add_subsection(YumConsumerErrataSection(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))