예제 #1
0
    def handle(self, request, context):

        try:

            repo=context.get("repo","")
            name=context.get("name","")
            baseurl=context.get("baseurl","")
            mirrorlist=context.get("mirrorlist","")

            target_groups = context.get("group_multiselect","")
            target_members = []

            for group in target_groups:

                group_members = get_group_members(group)

                for member in group_members:

                    #   add_yum_repo
                    add_yum_repo(instance_name = member, repo = repo , name = name , baseurl = baseurl , mirrorlist = mirrorlist)
                 
            return True
            

        except Exception:

            exceptions.handle(request)

            return False
예제 #2
0
    def handle(self, request, context):

        try:

            repo=context.get("repo","")
            baseurl=context.get("baseurl","")
            enabled=context.get("enabled","")
            refresh=context.get("refresh","")
            cache=context.get("cache","")
            gpgcheck=context.get("gpgcheck","")
            gpgautoimport=context.get("gpgautoimport","")
            repository_type=context.get("repository_type","")

            target_groups = context.get("group_multiselect","")
            target_members = []

            for group in target_groups:

                group_members = get_group_members(group)

                for member in group_members:

                    if member not in target_members:

                        target_members.append(member)


            for tmember in target_members:


                add_zypper_repo(instance_name=tmember,
                                    repo=repo,
                                    baseurl=baseurl,
                                    enabled=enabled,
                                    refresh=refresh,
                                    cache=cache,
                                    gpgcheck=gpgcheck,
                                    gpgautoimport=gpgautoimport)




            return True

        except Exception:

            exceptions.handle(request)

            return False
예제 #3
0
    def handle(self, request, context):

        print '<: context :>'
        print context
        print '----------------'
        print dir(context)
        print '::::::::::::::::'

        if (context.get('repository_type','')=='zypper'):

            #get_group_members 
            try:

                repo=context.get("repo","")
                baseurl=context.get("baseurl","")
                enabled=context.get("enabled","")
                refresh=context.get("refresh","")
                cache=context.get("cache","")
                gpgcheck=context.get("gpgcheck","")
                gpgautoimport=context.get("gpgautoimport","")
                repository_type=context.get("repository_type","")
                
                target_groups = context.get("group_multiselect","")
                target_members = []

                for group in target_groups:

                    group_members = get_group_members(group)  

                    for member in group_members:

                        if member not in target_members:

                            target_members.append(member)


                for tmember in target_members:


                    add_zypper_repo(instance_name=tmember, 
                                    repo=repo,
                                    baseurl=baseurl,
                                    enabled=enabled,
                                    refresh=refresh,
                                    cache=cache,
                                    gpgcheck=gpgcheck,
                                    gpgautoimport=gpgautoimport)

              
                
 
                return True

            except Exception:

                exceptions.handle(request)
 
                return False

        elif (context.get('repository_type','')=='yum'):

            try:

                repo=context.get("repo","")
                name=context.get("name","")
                baseurl=context.get("baseurl","")
                mirrorlist=context.get("mirrorlist","")

                target_groups = context.get("group_multiselect","")
                target_members = []

                for group in target_groups:

                    group_members = get_group_members(group)

                    for member in group_members:

                        #   add_yum_repo
                        add_yum_repo(instance_name = member, repo = repo , name = name , baseurl = baseurl , mirrorlist = mirrorlist)
                 
                return True
            

            except Exception:

                exceptions.handle(request)

                return False


        else: 

            pass