refs #1144 rebuild ogGetGroupDir

pull/1/head
Antonio Guerrero 2024-11-13 22:15:50 -06:00
parent 976b6367f3
commit 8db98b1289
1 changed files with 17 additions and 20 deletions

View File

@ -4,8 +4,8 @@ import os
import json
import ogGlobals
import NetLib
import SystemLib
import FileLib
@ -77,28 +77,25 @@ def ogChangeRepo(ip_repo, og_unit=None):
#@note repo = { REPO, CACHE } REPO por defecto
#@exception OG_ERR_FORMAT formato incorrecto.
#*/
def ogGetGroupDir():
REPO = ""
DIR = ""
GROUP = ""
def ogGetGroupDir(repo=None):
try:
repo = repo or "REPO"
if len(sys.argv) < 2:
SystemLib.ogHelp("ogGetGroupDir", "ogGetGroupDir str_repo", "ogGetGroupDir REPO ==> /opt/opengnsys/images/groups/Grupo1")
return
group = ogGetGroupName()
if group:
dir_path = FileLib.ogGetPath(repo, f"/groups/{group}")
if dir_path and os.path.isdir(dir_path):
return dir_path
if len(sys.argv) == 1:
REPO = "REPO"
else:
REPO = sys.argv[1]
GROUP = ogGetGroupName()
if GROUP:
DIR = FileLib.ogGetPath(REPO, "/groups/" + GROUP, stderr=subprocess.DEVNULL)
if os.path.isdir(DIR):
print(DIR)
return 0
return None
except Exception as e:
SystemLib.ogRaiseError(
"session",
ogGlobals.OG_ERR_FORMAT,
f"Error in ogGetGroupDir: {e}"
)
return None
#/**
# ogGetGroupName