def run_add(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 try: obj = Object(name=self.args.object, data=self.args.data, data_file=self.args.data_file, source=self.args.source, xsum=self.args.xsum, actions=self.args.actions) except ErrorInvalidObject as e: print (e) return 1 t.add_object(obj) # describe process for dry runs if self.args.dry_run: print('The following object would be added to the template: {0}'.format(t.name)) print(' - ' + str(obj)) print() return 1 # push our updated template try: res = self.cs.template_update(t) except ServiceException as e: print(e) return 1 return 0