Skip to content

Commit

Permalink
update dependencies and display project name as part of show config
Browse files Browse the repository at this point in the history
  • Loading branch information
kthare10 committed Oct 23, 2024
1 parent e73f641 commit f4bacc0
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,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))


## [1.7.3] - 08/05/2024
Expand Down
9 changes: 9 additions & 0 deletions fabrictestbed_extensions/fablib/config/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions fabrictestbed_extensions/fablib/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
3 changes: 3 additions & 0 deletions fabrictestbed_extensions/fablib/fablib.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ dependencies = [
"ipyleaflet",
"ipycytoscape",
"tabulate",
"fabrictestbed==1.7.8",
"fabrictestbed==1.7.9",
"paramiko",
"jinja2>=3.0.0",
"pandas",
Expand Down
4 changes: 1 addition & 3 deletions tests/unit/test_basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit f4bacc0

Please sign in to comment.