diff --git a/operators/nova-flavors/nova_flavors/flavor_synchronizer.py b/operators/nova-flavors/nova_flavors/flavor_synchronizer.py index db8aac13c..288e1d714 100644 --- a/operators/nova-flavors/nova_flavors/flavor_synchronizer.py +++ b/operators/nova-flavors/nova_flavors/flavor_synchronizer.py @@ -13,25 +13,28 @@ def __init__( self, username: str | None = "", password: str = "", - project_id: str | None = None, - user_domain_id=None, + project_name: str | None = "admin", + project_domain_name: str = "default", + user_domain_name="service", auth_url: str | None = None, ) -> None: self.username = username self.password = password - self.project_id = str(project_id) - self.user_domain_id = user_domain_id + self.project_name = str(project_name) + self.project_domain_name = str(project_domain_name) + self.user_domain_name = user_domain_name self.auth_url = auth_url @cached_property def _nova(self): return novaclient.Client( "2", - self.username, - self.password, - self.project_id, - self.auth_url, - user_domain_id=self.user_domain_id, + username=self.username, + password=self.password, + project_name=self.project_name, + project_domain_name=self.project_domain_name, + user_domain_name=self.user_domain_name, + auth_url=self.auth_url, ) def reconcile(self, desired_flavors: list[FlavorSpec]): diff --git a/operators/nova-flavors/nova_flavors/reconcile.py b/operators/nova-flavors/nova_flavors/reconcile.py index e1953ed70..e87beb790 100644 --- a/operators/nova-flavors/nova_flavors/reconcile.py +++ b/operators/nova-flavors/nova_flavors/reconcile.py @@ -27,11 +27,12 @@ def main(): if not os.path.isdir(flavors_dir): raise ValueError(f"flavors_dir '{flavors_dir}' is not a directory") synchronizer = FlavorSynchronizer( - username=os.environ.get("OS_USERNAME", ""), - password=os.environ.get("OS_PASSWORD", ""), - project_id=os.environ.get("OS_PROJECT_ID"), - user_domain_id=os.environ.get("OS_USER_DOMAIN_ID", ""), - auth_url=os.environ.get("OS_AUTH_URL"), + username=os.getenv("OS_USERNAME", ""), + password=os.getenv("OS_PASSWORD", ""), + project_name=os.getenv("OS_PROJECT_NAME", "admin"), + project_domain_name=os.getenv("OS_PROJECT_DOMAIN_NAME", "default"), + user_domain_name=os.getenv("OS_USER_DOMAIN_NAME", "service"), + auth_url=os.getenv("OS_AUTH_URL"), ) handler = SpecChangedHandler(synchronizer, read_flavors) diff --git a/operators/nova-flavors/tests/test_flavor_synchronizer.py b/operators/nova-flavors/tests/test_flavor_synchronizer.py index 34135c82b..f7732a1b9 100644 --- a/operators/nova-flavors/tests/test_flavor_synchronizer.py +++ b/operators/nova-flavors/tests/test_flavor_synchronizer.py @@ -11,8 +11,6 @@ def flavor_synchronizer(): return FlavorSynchronizer( username="test_username", password="test_password", - project_id="test_project_id", - user_domain_id="test_user_domain_id", auth_url="test_auth_url", ) @@ -46,8 +44,7 @@ def flavor(): def test_flavor_synchronizer_init(flavor_synchronizer): assert flavor_synchronizer.username == "test_username" assert flavor_synchronizer.password == "test_password" - assert flavor_synchronizer.project_id == "test_project_id" - assert flavor_synchronizer.user_domain_id == "test_user_domain_id" + assert flavor_synchronizer.user_domain_name == "service" assert flavor_synchronizer.auth_url == "test_auth_url"