self.event.set() # refresh stray health check
return "Removed host '{}'".format(host)
+ @async_completion
+ def update_host_addr(self, host, addr):
+ if host not in self.inventory:
+ raise OrchestratorError('host %s not registered' % host)
+ self.inventory[host]['addr'] = addr
+ self._save_inventory()
+ self._reset_con(host)
+ self.event.set() # refresh stray health check
+ return "Updated host '{}' addr to '{}'".format(host, addr)
+
@trivial_completion
def get_hosts(self):
"""
"""
raise NotImplementedError()
+ def update_host_addr(self, host, addr):
+ # type: (str, str) -> Completion
+ """
+ Update a host's address
+
+ :param host: hostname
+ :param addr: address (dns name or IP)
+ """
+ raise NotImplementedError()
+
def get_hosts(self):
# type: () -> Completion
"""
orchestrator.raise_if_exception(completion)
return HandleCommandResult(stdout=completion.result_str())
+ @orchestrator._cli_write_command(
+ 'orchestrator host set-addr',
+ 'name=host,type=CephString '
+ 'name=addr,type=CephString',
+ 'Update a host address')
+ def _update_set_addr(self, host, addr):
+ completion = self.update_host_addr(host, addr)
+ self._orchestrator_wait([completion])
+ orchestrator.raise_if_exception(completion)
+ return HandleCommandResult(stdout=completion.result_str())
+
@orchestrator._cli_read_command(
'orchestrator host ls',
'name=format,type=CephChoices,strings=json|plain,req=false',