X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=xapp_orchestrater%2Fdev%2Fxapp_onboarder%2Fxapp_onboarder%2Fhelm_controller%2FxApp_builder.py;fp=xapp_orchestrater%2Fdev%2Fxapp_onboarder%2Fxapp_onboarder%2Fhelm_controller%2FxApp_builder.py;h=ace97ae7b423bb4553d038846a494e7d42d7a2aa;hb=67d5a74c069b29cf0bd5b5cb7018e3ef2328368d;hp=8ef252ea82b286ef047993845d366336222ace4b;hpb=20253e36270d5474d899509d4d80f5a8baf762ec;p=ric-plt%2Fappmgr.git diff --git a/xapp_orchestrater/dev/xapp_onboarder/xapp_onboarder/helm_controller/xApp_builder.py b/xapp_orchestrater/dev/xapp_onboarder/xapp_onboarder/helm_controller/xApp_builder.py index 8ef252e..ace97ae 100644 --- a/xapp_orchestrater/dev/xapp_onboarder/xapp_onboarder/helm_controller/xApp_builder.py +++ b/xapp_orchestrater/dev/xapp_onboarder/xapp_onboarder/helm_controller/xApp_builder.py @@ -235,6 +235,7 @@ class xApp(): raise xAppError( "xApp " + self.chart_name + '-' + self.chart_version + " distribution failed. (Caused by: " + str(err) + ")" , err.status_code) def install_chart_package(xapp_chart_name, version, namespace, overridefile): + dirTomove = "/tmp/helm_template" try: tar = tarfile.open(xapp_chart_name + "-" + version + ".tgz") tar.extractall() @@ -250,13 +251,19 @@ class xApp(): except Exception as err: print(err) status = 0 - subprocess.run(["rm", "-rf", xapp_chart_name ]) - subprocess.run(["rm", "-rf", xapp_chart_name + "-" + version + ".tgz" ]) + if (os.getcwd() != dirTomove): + subprocess.run(["mv", xapp_chart_name, dirTomove]) + PATH=xapp_chart_name + "-" + version + ".tgz" + if os.path.isfile(PATH): + subprocess.run(["mv", xapp_chart_name + "-" + version + ".tgz", dirTomove ]) return status - def uninstall_chart_package(xapp_chart_name, namespace): - + def uninstall_chart_package(xapp_chart_name, namespace, version): + dirTomove = "/tmp/helm_template/" try: + subprocess.run(["rm", "-rf", dirTomove + xapp_chart_name]) + if version != "" : + subprocess.run(["rm", "-rf", dirTomove+xapp_chart_name + "-" + version + ".tgz"]) process = subprocess.run(["helm", "delete", xapp_chart_name, "--namespace=" + namespace], stdout=PIPE, stderr=PIPE, check=True) status = 1