]> git.apps.os.sepia.ceph.com Git - teuthology.git/commitdiff
teuthology-update-inventory: Add machine type flag
authorZack Cerza <zack@redhat.com>
Fri, 25 Mar 2022 20:25:02 +0000 (14:25 -0600)
committerZack Cerza <zack@redhat.com>
Mon, 28 Mar 2022 21:31:40 +0000 (15:31 -0600)
With this change, the tool can be trivially used to add new nodes to
paddles.

Signed-off-by: Zack Cerza <zack@redhat.com>
scripts/update_inventory.py

index 73da8aa67f83fa733f278030cb95d5a5b306a7fd..014e3ccf5cf65339c241cb50547def031a7a378b 100644 (file)
@@ -10,14 +10,16 @@ import logging
 
 doc = """
 usage: teuthology-update-inventory -h
-       teuthology-update-inventory [-v] REMOTE [REMOTE ...]
+       teuthology-update-inventory [-v] [-m type] REMOTE [REMOTE ...]
 
 Update the given nodes' inventory information on the lock server
 
 
-  -h, --help            show this help message and exit
-  -v, --verbose         be more verbose
-  REMOTE                hostnames of machines whose information to update
+  -h, --help                        show this help message and exit
+  -v, --verbose                     be more verbose
+  -m <type>, --machine-type <type>  optionally specify a machine type when 
+                                    submitting nodes for the first time
+  REMOTE                            hostnames of machines whose information to update
 
 """
 
@@ -27,10 +29,13 @@ def main():
     if args['--verbose']:
         teuthology.log.setLevel(logging.DEBUG)
 
+    machine_type = args.get('--machine-type')
     remotes = args.get('REMOTE')
     for rem_name in remotes:
         rem_name = teuthology.misc.canonicalize_hostname(rem_name)
         remote = teuthology.orchestra.remote.Remote(rem_name)
         remote.connect()
         inventory_info = remote.inventory_info
+        if machine_type:
+          inventory_info['machine_type'] = machine_type
         teuthology.lock.ops.update_inventory(inventory_info)