Skip to content

Commit 9df8fe6

Browse files
committed
fix: more detailed printout of information and error messages
1 parent 2d47785 commit 9df8fe6

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

src/DIRAC/DataManagementSystem/scripts/dirac_dms_filecatalog_cli.py

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,29 +59,36 @@ def main():
5959
fcType = allCatalogs[0]
6060
catalog = None
6161
else:
62-
print("Starting FileCatalog container client:")
62+
print(
63+
"\nStarting FileCatalog container console. \n"
64+
"Note that you will access several catalogs at the same time:"
65+
)
6366
print(f" {masterCatalog} - Master")
6467
for cat in allCatalogs:
6568
if cat != masterCatalog:
6669
cTypes = ["Write"] if cat in writeCatalogs else []
6770
cTypes.extend(["Read"] if cat in readCatalogs else [])
6871
print(f" {cat} - {'-'.join(cTypes)}")
69-
print("")
72+
print("If you want to work with a single catalog, specify it with the -f option\n")
7073

7174
if fcType:
75+
# We have to use a specific File Catalog, create it now
7276
from DIRAC.Resources.Catalog.FileCatalogFactory import FileCatalogFactory
7377

7478
result = FileCatalogFactory().createCatalog(fcType)
7579
if not result["OK"]:
7680
print(result["Message"])
7781
dexit(-1)
7882
catalog = result["Value"]
79-
print(f"Starting {fcType} client")
83+
print(f"Starting {fcType} console")
8084

8185
from DIRAC.DataManagementSystem.Client.FileCatalogClientCLI import FileCatalogClientCLI
8286

83-
cli = FileCatalogClientCLI(catalog)
84-
cli.cmdloop()
87+
if catalog:
88+
cli = FileCatalogClientCLI(catalog)
89+
cli.cmdloop()
90+
else:
91+
print(f"Failed to access the catalog {fcType if fcType else 'container'}")
8592

8693

8794
if __name__ == "__main__":

0 commit comments

Comments
 (0)