def delete_snapshot(self, snapshot): # get all of the file paths file_paths = snapshot.get_all_lib_paths() paths = [] for file_path in file_paths: if file_path.find("##") != -1: sequence_paths = snapshot.get_expanded_lib_paths() for path in sequence_paths: paths.append(path) else: paths.append(file_path) files = snapshot.get_related_sobjects("sthpw/file") for file in files: print("Deleting file: ", file.get_search_key()) file.delete() # remove the files from the repo for file_path in paths: print("Removing path: ", file_path) FileUndo.remove(file_path) print("Deleting snapshot: ", snapshot.get_search_key()) snapshot.delete()
def execute(my): web = my.get_web() keys = web.get_form_keys() file_name = my.kwargs.get("file_name") # process and get the uploaded files dir = Environment.get_upload_dir() license_file = "%s/%s" % (dir, file_name) if not os.path.exists(license_file): raise TacticException("Error retrieving the license file in [%s]" % license_file) std_name = 'tactic-license.xml' head, file_name = os.path.split(license_file) # no restrictions for license file #if file_name != std_name: # raise TacticException("License file name should be named tactic-license.xml. The file given is [%s]" %file_name) license_dir = Environment.get_license_dir() current_license = "%s/%s" % (license_dir, std_name) if os.path.exists(current_license): FileUndo.remove(current_license) FileUndo.move(license_file, current_license) my.add_description('Renewed license file') security = Environment.get_security() security.reread_license()
def execute(self): web = self.get_web() keys = web.get_form_keys() file_name = self.kwargs.get("file_name") # process and get the uploaded files dir = Environment.get_upload_dir() license_file = "%s/%s" % (dir, file_name) if not os.path.exists(license_file): raise TacticException("Error retrieving the license file in [%s]"%license_file) std_name = 'tactic-license.xml' head, file_name = os.path.split(license_file) # no restrictions for license file #if file_name != std_name: # raise TacticException("License file name should be named tactic-license.xml. The file given is [%s]" %file_name) license_dir = Environment.get_license_dir() current_license = "%s/%s" %(license_dir, std_name) if os.path.exists(current_license): FileUndo.remove(current_license) FileUndo.move(license_file, current_license) self.add_description('Renewed license file') security = Environment.get_security() security.reread_license()
def delete_snapshot(my, snapshot): # get all of the file paths file_paths = snapshot.get_all_lib_paths() files = snapshot.get_related_sobjects("sthpw/file") for file in files: print "deleting file: ", file.get_search_key() file.delete() # remove the files from the repo for file_path in file_paths: "removing path: ", file_path FileUndo.remove(file_path) print "deleting snapshot: ", snapshot.get_search_key() snapshot.delete()
def execute(my): template = my.kwargs.get("template") template_dir = Environment.get_template_dir() template = my.kwargs.get("template") from pyasm.search import FileUndo path = "%s/%s-1.0.0.zip" % (template_dir, template) if not os.path.exists(path): raise Exception("Path [%s] does not exists" % path) FileUndo.remove(path) path = "%s/%s" % (template_dir, template) FileUndo.remove(path)
def execute(self): template = self.kwargs.get("template") template_dir = Environment.get_template_dir() template = self.kwargs.get("template") from pyasm.search import FileUndo path = "%s/%s-1.0.0.zip" % (template_dir, template) if not os.path.exists(path): raise Exception("Path [%s] does not exists" % path) FileUndo.remove(path) path = "%s/%s" % (template_dir, template) FileUndo.remove(path)