コード例 #1
0
ファイル: object.py プロジェクト: kororaproject/kp-canvas
    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
コード例 #2
0
ファイル: object.py プロジェクト: Reaver385/canvas
    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