Ejemplo n.º 1
0
    def run_rm(self):
        t = Template(self.args.template, user=self.args.username)

        try:
            t = self.cs.template_get(t)

        except ServiceException as e:
            print(e)
            return 1

        for o in self.args.objects:
            try:
                obj = Object(name=o)

            except ErrorInvalidObject as e:
                print (e)
                return 1

            t.remove_object(obj)

        if self.args.dry_run:
            # TODO: print changes
            return 1

        # push our updated template
        try:
            res = self.cs.template_update(t)

        except ServiceException as e:
            print(e)
            return 1

        return 0
Ejemplo n.º 2
0
    def run_rm(self):
        t = Template(self.args.template, user=self.args.username)

        try:
            t = self.cs.template_get(t)

        except ServiceException as e:
            print(e)
            return 1

        for o in self.args.objects:
            try:
                obj = Object(name=o)

            except ErrorInvalidObject as e:
                print (e)
                return 1

            t.remove_object(obj)

        if self.args.dry_run:
            # TODO: print changes
            return 1

        # push our updated template
        try:
            res = self.cs.template_update(t)

        except ServiceException as e:
            print(e)
            return 1

        return 0