Commit 492abdd1 authored by Jie Yuan's avatar Jie Yuan
Browse files

remove epic

parent 3be78e09
......@@ -15,7 +15,7 @@ def main(argv):
try:
opts, args = getopt.getopt(argv,'h:t:S:THVpd:',['help','version','site=','test',\
'host=','tag=','print','dump','type=','list-service-type','show-config','send',\
'epic-version-file=', 'handle-server-path=','with-version=','component='])
'handle-server-path=','with-version=','component='])
except getopt.GetoptError:
print (help_info())
sys.exit(0)
......@@ -28,7 +28,6 @@ def main(argv):
send = 0
readfile =0
filename=""
epic_version_file=""
handle_server_path=""
specified_components = []
no_specified_components = 0
......@@ -91,8 +90,7 @@ def main(argv):
svmonreport.print_config_file()
if opt in ['--send']:
send=1
if opt in ['--epic-version-file']:
epic_version_file = arg
if opt in ['--handle-server-path']:
handle_server_path = arg
......@@ -105,10 +103,10 @@ def main(argv):
if save == 1:
print("Saving configurations ....")
if ( epic_version_file == "" and handle_server_path ==""):
if ( handle_server_path ==""):
svmonreport.save_to_json()
if ( epic_version_file != "" or handle_server_path !=""):
svmonreport.save_b2handle_config_to_json(handle_server_path=handle_server_path, epic_version_file=epic_version_file)
if (handle_server_path !=""):
svmonreport.save_b2handle_config_to_json(handle_server_path=handle_server_path)
if no_specified_components >0:
svmonreport.save_with_components_to_json(specified_components, specified_versions)
......@@ -161,10 +159,9 @@ def help_info():
--list-service-type List all supported service types
--show-config Show the site,host, service type configurations.
--send Send the reports to SVMON server.
--epic-version-file Locate the version file for epic service component when your service type is "b2handle"
--handle-server-path Locate the directory where handle is installed whenservice type is "b2handle"
--handle-server-path Locate the directory where handle is installed when service type is "b2handle".
If you have problems with SVMON client usage, please contact us(jie.yuan@kit.edu).
If you have problems with SVMON client usage, please contact us(jie.yuan@kit.edu).
'''
......
{"site": "kit", "service_type":"b2safe", "host":"irods-3-eudat.lsdf.kit.edu"}
{"service_type": "b2handle", "handle_server_path": "/home/jie/develop/handle-server", "host": "gitlab.eudat.eu", "site": "KIT"}
\ No newline at end of file
......@@ -69,10 +69,8 @@ class SVMONReport:
exit(-1)
with open(filename, 'r') as f:
load_dict= json.load(f)
if load_dict.has_key('epic_version_file') or load_dict.has_key('handle_server_path'):
if load_dict.has_key('epic_version_file') and load_dict.get('epic_version_file') != None and load_dict.get('epic_version_file') != '':
b2handle_config['epic_version_file'] = load_dict.get('epic_version_file')
if load_dict.has_key('handle_server_path') and load_dict.get('handle_server_path') != None and load_dict.get('handle_server_path') != '':
if load_dict.has_key('handle_server_path'):
if load_dict.get('handle_server_path') != None and load_dict.get('handle_server_path') != '':
b2handle_config['handle_server_path'] = load_dict.get('handle_server_path')
self.tags = services.get_service_tag(self.service_type,b2handle_config)
else:
......@@ -162,17 +160,14 @@ class SVMONReport:
print("No services to be jsonified")
return {}
def save_b2handle_config_to_json(self,handle_server_path=None,epic_version_file=None):
if handle_server_path == None and epic_version_file == None:
def save_b2handle_config_to_json(self,handle_server_path=None):
if handle_server_path == None :
print("No b2handle configuration input")
exit(-1)
if handle_server_path != None and isinstance(handle_server_path,str) == False:
print("Handle server path should be a string")
exit(-1)
if epic_version_file != None and isinstance(epic_version_file,str) == False:
print("Handle server path should be a string")
exit(-1)
if epic_version_file == "" and handle_server_path == "":
if handle_server_path == "":
print("No input for b2handle configuration")
exit(-1)
......@@ -180,27 +175,9 @@ class SVMONReport:
res['site']= self.site
res['host'] = self.host
res['service_type'] = self.service_type
if epic_version_file != "" and handle_server_path != "":
res['epic_version_file'] = epic_version_file
res['handle_server_path'] = handle_server_path
elif epic_version_file == "" and handle_server_path != "":
if handle_server_path != "":
res['handle_server_path'] = handle_server_path
print("No epic_version_file input")
cwd = os.path.dirname(services.__file__)
filename = cwd + "/config.json"
with open(filename, 'r') as f:
load_dict= json.load(f)
if load_dict.has_key('epic_version_file'):
res['epic_version_file'] = load_dict.get('epic_version_file')
elif epic_version_file != "" and handle_server_path == "":
res['epic_version_file'] = epic_version_file
print("No handle_server_path input")
cwd = os.path.dirname(services.__file__)
filename = cwd + "/config.json"
with open(filename, 'r') as f:
load_dict= json.load(f)
if load_dict.has_key('handle_server_path'):
res['handle_server_path'] = load_dict.get('handle_server_path')
cwd = os.path.dirname(services.__file__)
filename = cwd + "/config.json"
......@@ -228,8 +205,6 @@ class SVMONReport:
filename = cwd + "/config.json"
with open(filename, 'r') as f:
load_dict= json.load(f)
if load_dict.has_key('epic_version_file') and load_dict.get('epic_version_file') != None and load_dict.get('epic_version_file') != "":
res['epic_version_file'] = load_dict.get('epic_version_file')
if load_dict.has_key('handle_server_path') and load_dict.get('handle_server_path') != None and load_dict.get('handle_server_path') != "":
res['handle_server_path'] = load_dict.get('handle_server_path')
......
......@@ -11,8 +11,6 @@ _services['gitlab']=['gitlab']
_services['svmon']=['spring','angular']
_services['b2access']=['b2access_unity']
_services['b2find']=['b2find','ckan']
_services['b2handle']=['handle','epic']
_services['B2HANDLE']=['handle','epic']
_services['b2drop']=['nextcloud']
_services['dpmt']=['plone']
_services['eudat_website']=['drupal']
......@@ -21,6 +19,8 @@ _services['gocdb']=['creg']
_services['b2access']=['unity']
_services['svmon_client']=['client']
_services['b2share']=["b2share"]
_services['b2handle'] = ['handle']
_services['B2HANDLE'] = ['handle']
_rpm_packages={}
_rpm_packages['b2safe']='b2safe'
......@@ -110,11 +110,9 @@ def get_service_tag(service_type,configs=None):
elif service_type == "svmon":
return _tags['svmon']
elif service_type == "b2handle" or service_type == "B2HANDLE":
if configs.has_key('epic_version_file') or configs.has_key('handle_server_path'):
if configs.has_key('handle_server_path'):
tags=[]
if configs.has_key('epic_version_file') and configs.get('epic_version_file') != '' and configs.get('epic_version_file') != None:
tags.append(get_epic_version(configs.get('epic_version_file')))
if configs.has_key('handle_server_path') and configs.get('handle_server_path') != '' and configs.get('handle_server_path') != None:
if configs.get('handle_server_path') != None and configs.get('handle_server_path') != '' :
tags.append(get_handle_server(configs.get('handle_server_path')))
return tags
else:
......@@ -170,31 +168,6 @@ def get():
tags=get_service_tag("svmon_client")
return tags[0]
def get_epic_version(epic_version_file):
exist = os.path.exists(epic_version_file)
if exist:
f=open(epic_version_file,'r')
while True:
line=f.readline()
if not line:
f.close()
print("The epic version can not be resolved from "+ epic_version_file)
exit(1)
break
if line.find("VERSION=") != -1 :
f.close()
if line.find("\'") != -1:
line=line.replace("\'","")
for i in range(len(line)):
if line[i].isupper() == True:
line=line.replace(line[i],"=")
if line.find("=") != -1:
line=line.replace("=","")
return line
break
print("No epic version information in " + epic_version_file)
exit(1)
......@@ -210,8 +183,6 @@ def get_handle_server(handle_server_path):
exit(1)
tmp = tmp[0]
tmp = tmp.split('version')
return tmp[1].lstrip()
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment