Volans has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/318550

Change subject: conftool: add --host option
......................................................................

conftool: add --host option

It allows to force the change in non-interactive way if all the objects
belongs to the same host

Bug: T149213
Change-Id: I1f6ec5d4cb60cb84c1b372382b412aeb712c7f5d
---
M conftool/cli/tool.py
1 file changed, 9 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/operations/software/conftool 
refs/changes/50/318550/1

diff --git a/conftool/cli/tool.py b/conftool/cli/tool.py
index 63cad8f..0241096 100644
--- a/conftool/cli/tool.py
+++ b/conftool/cli/tool.py
@@ -186,9 +186,16 @@
 
     def raise_warning(self, objects):
         tag_hosts = defaultdict(list)
+        hosts_set = set()
         for obj in objects:
             dir = os.path.dirname(obj.key).replace(self.entity.base_path(), '')
             tag_hosts[dir].append(obj.name)
+            hosts_set.add(obj.name)
+
+        if self.args.host and len(hosts_set) <= 1:
+            # The host option is set and all objects belong to the same host
+            return
+
         print "The selector you chose has selected the following objects:"
         if self.args.yaml:
             print yaml.dump(tag_hosts, default_flow_style=False)
@@ -212,6 +219,8 @@
                         choices=ToolCli.object_types.keys(), default='node')
     parser.add_argument('--yaml', action="store_true",
                         default=False, help="output values in YAML")
+    parser.add_argument('--host', action='store_true',
+                        help='Do not raise warning if all objects belong to 
the same host')
     parser.add_argument('--debug', action="store_true",
                         default=False, help="print debug info")
     parser.add_argument('--quiet', action="store_true", dest='quiet',

-- 
To view, visit https://gerrit.wikimedia.org/r/318550
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I1f6ec5d4cb60cb84c1b372382b412aeb712c7f5d
Gerrit-PatchSet: 1
Gerrit-Project: operations/software/conftool
Gerrit-Branch: master
Gerrit-Owner: Volans <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to