Exemplo n.º 1
0
 def add_host(self, spec: HostSpec) -> None:
     if spec.hostname in self._inventory:
         # addr
         if self.get_addr(spec.hostname) != spec.addr:
             self.set_addr(spec.hostname, spec.addr)
         # labels
         for label in spec.labels:
             self.add_label(spec.hostname, label)
     else:
         self._inventory[spec.hostname] = spec.to_json()
         self.save()
Exemplo n.º 2
0
 def add_host(self, spec: HostSpec) -> None:
     self._inventory[spec.hostname] = spec.to_json()
     self.save()