refs #1144 rebuild ogGetGroupDir
parent
976b6367f3
commit
8db98b1289
|
@ -4,8 +4,8 @@ import os
|
||||||
import json
|
import json
|
||||||
|
|
||||||
import ogGlobals
|
import ogGlobals
|
||||||
import NetLib
|
|
||||||
import SystemLib
|
import SystemLib
|
||||||
|
import FileLib
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -77,28 +77,25 @@ def ogChangeRepo(ip_repo, og_unit=None):
|
||||||
#@note repo = { REPO, CACHE } REPO por defecto
|
#@note repo = { REPO, CACHE } REPO por defecto
|
||||||
#@exception OG_ERR_FORMAT formato incorrecto.
|
#@exception OG_ERR_FORMAT formato incorrecto.
|
||||||
#*/
|
#*/
|
||||||
def ogGetGroupDir():
|
def ogGetGroupDir(repo=None):
|
||||||
REPO = ""
|
try:
|
||||||
DIR = ""
|
repo = repo or "REPO"
|
||||||
GROUP = ""
|
|
||||||
|
|
||||||
if len(sys.argv) < 2:
|
group = ogGetGroupName()
|
||||||
SystemLib.ogHelp("ogGetGroupDir", "ogGetGroupDir str_repo", "ogGetGroupDir REPO ==> /opt/opengnsys/images/groups/Grupo1")
|
if group:
|
||||||
return
|
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:
|
return None
|
||||||
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
|
|
||||||
|
|
||||||
|
except Exception as e:
|
||||||
|
SystemLib.ogRaiseError(
|
||||||
|
"session",
|
||||||
|
ogGlobals.OG_ERR_FORMAT,
|
||||||
|
f"Error in ogGetGroupDir: {e}"
|
||||||
|
)
|
||||||
|
return None
|
||||||
|
|
||||||
#/**
|
#/**
|
||||||
# ogGetGroupName
|
# ogGetGroupName
|
||||||
|
|
Loading…
Reference in New Issue