Skip to content

Commit 2887fce

Browse files
committed
Use the nicer way to check if using old client
instead of checking individual facade versions
1 parent a1c4f20 commit 2887fce

3 files changed

Lines changed: 4 additions & 5 deletions

File tree

juju/machine.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ async def destroy(self, force=False):
2222
Blocks until the machine is actually removed.
2323
2424
"""
25-
if client.MachineManagerFacade.best_facade_version(self.connection) <= 6:
25+
if self.connection.is_using_old_client:
2626
# Then we'll use the DestroyMachines from client.ClientFacade
2727
facade = client.ClientFacade.from_connection(self.connection)
2828
await facade.DestroyMachines(force=force, machine_names=[self.id])

juju/model.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2012,7 +2012,7 @@ async def get_constraints(self):
20122012
"""
20132013
constraints = {}
20142014
facade_cls = client.ModelConfigFacade
2015-
if facade_cls.best_facade_version(self.connection()) <= 2:
2015+
if self.connection().is_using_old_client:
20162016
facade_cls = client.ClientFacade
20172017

20182018
facade = facade_cls.from_connection(self.connection())
@@ -2134,7 +2134,7 @@ async def set_constraints(self, constraints):
21342134
:param dict config: Mapping of model constraints
21352135
"""
21362136
facade_cls = client.ModelConfigFacade
2137-
if facade_cls.best_facade_version(self.connection()) <= 2:
2137+
if self.connection().is_using_old_client:
21382138
facade_cls = client.ClientFacade
21392139
facade = facade_cls.from_connection(self.connection())
21402140

juju/provisioner.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -307,8 +307,7 @@ async def install_agent(self, connection, nonce, machine_id):
307307
disable_package_commands = False
308308

309309
facade_cls = client.MachineManagerFacade
310-
311-
if facade_cls.best_facade_version(connection) <= 6:
310+
if connection.is_using_old_client:
312311
facade_cls = client.ClientFacade
313312

314313
facade = facade_cls.from_connection(connection)

0 commit comments

Comments
 (0)