summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJose M. Guisado <jguisado@soleta.eu>2023-05-17 11:31:27 +0200
committerJose M. Guisado <jguisado@soleta.eu>2023-05-17 12:44:50 +0200
commitfa51f2be8f6db224d82c8e50e2ad43b0f4abd722 (patch)
tree77ee8bbc8848bc8e1e35a29a56ab8ca2a69fbb2f
parent0c6dd12f4c743c998071fb31c80064b8c6ee40df (diff)
src: remove unused legacy software inventory code
Remove unnecessary InventarioSoftware invocation inside image_create operation. Software inventory is executed after image creation (see ogRest.py). Remove legacy 'path' parameter. This parameter was used to specify the path of a text file in which legacy bash scripts wrote the software inventory of the client (something like "Csft-{ip}..."). Fixes: 04bb35bd86b58c ("live: rewrite software inventory") Fixes: 2e3d47b7b8db69 ("Avoid writting /software output to a file")
-rw-r--r--src/live/ogOperations.py17
-rw-r--r--src/ogRest.py18
2 files changed, 9 insertions, 26 deletions
diff --git a/src/live/ogOperations.py b/src/live/ogOperations.py
index 6f759d7..8e5da48 100644
--- a/src/live/ogOperations.py
+++ b/src/live/ogOperations.py
@@ -266,7 +266,7 @@ class OgLiveOperations:
logging.info('Starting OS at disk %s partition %s', disk, partition)
return output.decode('utf-8')
- def software(self, request, path, ogRest):
+ def software(self, request, ogRest):
disk = request.getDisk()
partition = request.getPartition()
partdev = get_partition_device(int(disk), int(partition))
@@ -399,13 +399,11 @@ class OgLiveOperations:
logging.info('Image restore command OK')
return output
- def image_create(self, path, request, ogRest):
+ def image_create(self, request, ogRest):
disk = int(request.getDisk())
partition = int(request.getPartition())
name = request.getName()
repo = request.getRepo()
- cmd_software = f'{ogClient.OG_PATH}interfaceAdm/InventarioSoftware {disk} ' \
- f'{partition} {path}'
image_path = f'/opt/opengnsys/images/{name}.img'
self._ogbrowser_clear_logs()
@@ -416,17 +414,6 @@ class OgLiveOperations:
logging.error('ogChangeRepo could not change repository to %s', repo)
raise ValueError(f'Error: Cannot change repository to {repo}')
- try:
- ogRest.proc = subprocess.Popen([cmd_software],
- stdout=subprocess.PIPE,
- shell=True,
- executable=OG_SHELL)
- (output, error) = ogRest.proc.communicate()
- except:
- self._restartBrowser(self._url)
- logging.error('Exception when running software inventory subprocess')
- raise ValueError('Error: Incorrect command value')
-
if ogRest.terminated:
return
diff --git a/src/ogRest.py b/src/ogRest.py
index ac312f2..77a5d5d 100644
--- a/src/ogRest.py
+++ b/src/ogRest.py
@@ -120,9 +120,9 @@ class ogThread():
client.send(response.get())
client.disconnect()
- def software(client, request, path, ogRest):
+ def software(client, request, ogRest):
try:
- software = ogRest.operations.software(request, path, ogRest)
+ software = ogRest.operations.software(request, ogRest)
except Exception as e:
ogRest.send_internal_server_error(client, exc=e)
return
@@ -178,12 +178,10 @@ class ogThread():
client.send(response.get())
ogRest.state = ThreadState.IDLE
- def image_create(client, path, request, ogRest):
+ def image_create(client, request, ogRest):
try:
- image_info = ogRest.operations.image_create(path,
- request,
- ogRest)
- software = ogRest.operations.software(request, path, ogRest)
+ image_info = ogRest.operations.image_create(request, ogRest)
+ software = ogRest.operations.software(request, ogRest)
except Exception as e:
ogRest.send_internal_server_error(client, exc=e)
return
@@ -394,8 +392,7 @@ class ogRest():
threading.Thread(target=ogThread.session, args=(client, request, self,)).start()
def process_software(self, client, request):
- path = '/tmp/CSft-' + client.ip + '-' + str(request.getPartition())
- threading.Thread(target=ogThread.software, args=(client, request, path, self,)).start()
+ threading.Thread(target=ogThread.software, args=(client, request, self,)).start()
def process_hardware(self, client):
threading.Thread(target=ogThread.hardware, args=(client, self,)).start()
@@ -420,8 +417,7 @@ class ogRest():
sys.exit(0)
def process_imagecreate(self, client, request):
- path = '/tmp/CSft-' + client.ip + '-' + request.getPartition()
- threading.Thread(target=ogThread.image_create, args=(client, path, request, self,)).start()
+ threading.Thread(target=ogThread.image_create, args=(client, request, self,)).start()
def process_refresh(self, client):
threading.Thread(target=ogThread.refresh, args=(client, self,)).start()