refs #1144 rebuild ogGetGroupDir
parent
976b6367f3
commit
8db98b1289
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue