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 repos = [] for r in self.args.repo: r = Repository(r) if t.remove_repo(r): repos.append(r) repos.sort(key=lambda x: x.stub) # describe process for dry runs if self.args.dry_run: if len(repos): print('The following would be removed from the template: {0}'. format(t.name)) for r in repos: print(' - ' + str(r)) print() print('Summary:') print(' - Repo(s): %d' % (len(repos))) print() else: print('No template changes required.') print('No action peformed during this dry-run.') return 0 if not len(repos): print('info: no changes detected, template up to date.') return 0 # push our updated template try: res = self.cs.template_update(t) except ServiceException as e: print(e) return 1
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 repos = [] for r in self.args.repo: r = Repository(r) if t.remove_repo(r): repos.append(r) repos.sort(key=lambda x: x.stub) # describe process for dry runs if self.args.dry_run: if len(repos): print('The following would be removed from the template: {0}'.format(t.name)) for r in repos: print(' - ' + str(r)) print() print('Summary:') print(' - Repo(s): %d' % ( len(repos) )) print() else: print('No template changes required.') print('No action peformed during this dry-run.') return 0 if not len(repos): print('info: no changes detected, template up to date.') return 0 # push our updated template try: res = self.cs.template_update(t) except ServiceException as e: print(e) return 1