Print

Print


Commit in java/sandbox/data-cat/src/main/python/hpsdatacat on MAIN
delete.py+35added 649
Add script for deleting files form the catalog (tested).

java/sandbox/data-cat/src/main/python/hpsdatacat
delete.py added at 649
--- java/sandbox/data-cat/src/main/python/hpsdatacat/delete.py	                        (rev 0)
+++ java/sandbox/data-cat/src/main/python/hpsdatacat/delete.py	2014-06-02 20:04:23 UTC (rev 649)
@@ -0,0 +1,35 @@
+"""
+Delete a file from the data catalog.
+"""
+
+import argparse
+
+# import utility stuff from hpsdatacat
+from util import *
+
+# get connection_string string
+connection_string = get_ssh_connection_string()
+
+# get the command to use
+script_cmd = get_datacat_command( 'rm' )
+
+# site
+site = get_default_site()
+
+parser = argparse.ArgumentParser(description='Register file in the data catalog')
+parser.add_argument('-p', '--path', help='path to delete from the data catalog')
+args = vars(parser.parse_args())
+
+if args['path'] == None:
+    raise Exception('Missing path argument.')
+else:
+    path = args['path']
+
+cmd = 'ssh %s %s --force %s' % (connection_string, script_cmd, path)
+
+print "Executing command ..."
+print cmd
+
+lines, errors, return_value = run_process(cmd)
+
+print "return value: %s" % str(return_value) 
SVNspam 0.1