Repository: fabric-testbed/fabrictestbed-extensions (language: python)

Issue:
Display Project Name as part of Show Config
Display Project Name as part of Show Config


Discussion / hints:

Fix patch:
diff --git a/CHANGELOG.md b/CHANGELOG.md
index e7953ae8..31c4ba50 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -8,6 +8,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
 
 ## Unreleased
 
+
+
+## [1.7.4] - 11/05/2024 
+
 ### Added 
 - Missing docstrings in network_service module (Issue [#313](https://github.com/fabric-testbed/fabrictestbed-extensions/issues/314))
 - Artifact Manager Support (Issue [#358](https://github.com/fabric-testbed/fabrictestbed-extensions/issues/358))
@@ -28,6 +32,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
 - Node objects returned from slice.get_node(name) are not the same as the node objects returned from slice.get_nodes() (Issue [#380](https://github.com/fabric-testbed/fabrictestbed-extensions/issues/380))
 - Multiple calls to fablib.get_slice(name) in the same interpreter yield different objects (Issue [#379](https://github.com/fabric-testbed/fabrictestbed-extensions/issues/379))
 - FablibManager.get_slices doesn't return unsubmitted slices created by new_slice() (Issue [#294](https://github.com/fabric-testbed/fabrictestbed-extensions/issues/294))
+- Display Project Name in show_config() (Issue [#384](https://github.com/fabric-testbed/fabrictestbed-extensions/issues/384))
 - Add support for Attestable Switch from CREASE project (PR [#386](https://github.com/fabric-testbed/fabrictestbed-extensions/pull/386))
 
 
diff --git a/pyproject.toml b/pyproject.toml
index f12852f4..5a9c4eb6 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -20,7 +20,7 @@ dependencies = [
     "ipyleaflet",
     "ipycytoscape",
     "tabulate",
-    "fabrictestbed==1.7.8",
+    "fabrictestbed==1.7.9",
     "paramiko",
     "jinja2>=3.0.0",
     "pandas",


Test patch:
diff --git a/fabrictestbed_extensions/fablib/config/config.py b/fabrictestbed_extensions/fablib/config/config.py
index 277eacf6..6ab43e6e 100644
--- a/fabrictestbed_extensions/fablib/config/config.py
+++ b/fabrictestbed_extensions/fablib/config/config.py
@@ -132,6 +132,7 @@ class Config:
         Constants.AM_HOST: "Artifact Manager",
         Constants.TOKEN_LOCATION: "Token File",
         Constants.PROJECT_ID: "Project ID",
+        Constants.PROJECT_NAME: "Project Name",
         Constants.BASTION_USERNAME: "Bastion Username",
         Constants.BASTION_KEY_LOCATION: "Bastion Private Key File",
         Constants.BASTION_HOST: "Bastion Host",
@@ -568,6 +569,14 @@ def set_project_id(self, project_id: str):
         """
         self.runtime_config[Constants.PROJECT_ID] = project_id
 
+    def get_project_name(self):
+        """
+        Get the Project Name:
+        :return: Project Name
+        :rtype: String
+        """
+        return self.runtime_config.get(Constants.PROJECT_NAME)
+
     def set_log_level(self, log_level: str = "INFO"):
         """
         Sets the current log level for logging
diff --git a/fabrictestbed_extensions/fablib/constants.py b/fabrictestbed_extensions/fablib/constants.py
index 8381626e..6f5e9649 100644
--- a/fabrictestbed_extensions/fablib/constants.py
+++ b/fabrictestbed_extensions/fablib/constants.py
@@ -111,6 +111,7 @@ class Constants:
     AM_HOST = "am_host"
     TOKEN_LOCATION = "token_location"
     PROJECT_ID = "project_id"
+    PROJECT_NAME = "project_name"
     BASTION_HOST = "bastion_host"
     BASTION_USERNAME = "bastion_username"
     BASTION_KEY_LOCATION = "bastion_key_location"
diff --git a/fabrictestbed_extensions/fablib/fablib.py b/fabrictestbed_extensions/fablib/fablib.py
index f0fbaab1..9c1b0017 100644
--- a/fabrictestbed_extensions/fablib/fablib.py
+++ b/fabrictestbed_extensions/fablib/fablib.py
@@ -1160,6 +1160,9 @@ def __build_manager(self) -> FabricManager:
             logging.debug("Fabric manager initialized!")
             # Update Project ID to be same as in Slice Manager
             self.set_project_id(project_id=self.manager.project_id)
+            self.runtime_config[Constants.PROJECT_NAME] = (
+                self.manager.get_project_name()
+            )
             self.determine_bastion_username()
         except Exception as e:
             logging.error(e, exc_info=True)
diff --git a/tests/unit/test_basic.py b/tests/unit/test_basic.py
index 3b1a76f0..cfdfc1f8 100644
--- a/tests/unit/test_basic.py
+++ b/tests/unit/test_basic.py
@@ -62,9 +62,7 @@ def test_fablib_manager_test_only_orchestrator_host(self):
     def test_fablib_manager_test_only_project_id(self):
         os.environ[Constants.FABRIC_PROJECT_ID] = "dummy"
         os.environ[Constants.FABRIC_TOKEN_LOCATION] = self.DUMMY_TOKEN_LOCATION
-        self.assertRaises(
-            TokenManagerException, FablibManager, fabric_rc=self.rcfile.name
-        )
+        self.assertRaises(Exception, FablibManager, fabric_rc=self.rcfile.name)
 
     def test_fablib_manager_test_only_token_location(self):
         os.environ[Constants.FABRIC_TOKEN_LOCATION] = "dummy"