mgr/cephadm: make 'host add' idempotent

Do not let prime_empty_host blow away inventory.

Signed-off-by: Sage Weil <sage@newdream.net>
This commit is contained in:
Sage Weil 2021-05-03 12:04:28 -04:00
parent 2f2c997652
commit a8acc354dc

View File

@ -1409,8 +1409,9 @@ Then run the following:
'args': [f'{k}={v}' for k, v in spec.location.items()],
})
if spec.hostname not in self.inventory:
self.cache.prime_empty_host(spec.hostname)
self.inventory.add_host(spec)
self.cache.prime_empty_host(spec.hostname)
self.offline_hosts_remove(spec.hostname)
self.event.set() # refresh stray health check
self.log.info('Added host %s' % spec.hostname)