Exemplo n.º 1
0
    def __init__(self, request, *args, **kwargs):

        super(AddMemberToGroupForm, self).__init__(request, *args, **kwargs)

        group_name = self.initial.get('group_name',None)

        members_list_tuple = []

        available_members = []

        available_members_tuple = []

        existing_group_members = get_group_members(group_name)

        for member in get_members():

            if member.id not in existing_group_members:
   
                available_members.append(member.id)

        for member in available_members:

            available_members_tuple.append((str(member),str(member)))

        self.fields['members'].choices = available_members_tuple 
Exemplo n.º 2
0
    def handle(self, request, data):

        try:

            minions_list =  data.get('salt_minions',None)

            registered_members = []
            registered_members_objects = get_members()

            for member in registered_members_objects:

                registered_members.append(member.id) 

            if minions_list:


                for minion in minions_list:

                    if minion not in registered_members:

                        pass
                        #create_member(member_name=minion,member_type="instance",member_group_names=[])
            

            return True



        except Exception:

            response = exceptions.handle(request, ignore=True)

            messages.error(request, _('Unable to update member'))
Exemplo n.º 3
0
    def get_members_data(self):

        members = []

        try:

            members = get_members()

        except exceptions.NotAvailable:

            exceptions.handle(self.request,_('Unable to connect to Salt-master:'))

        return members
Exemplo n.º 4
0
    def __init__(self, request, *args, **kwargs):

        super(AddMemberForm, self).__init__(request, *args, **kwargs)

        #initial_salt_minions_list = self.initial.get('minions_list',None)

        minions_list_tuple = []

        registered_members = []
        registered_members_objects = get_members()

        for member in registered_members_objects:

            registered_members.append(member.id)

        for minion in minions_list():

            if minion not in registered_members:

                minions_list_tuple.append((str(minion),str(minion)))

        self.fields['salt_minions'].choices = minions_list_tuple