Explorar o código

* Updates from code reviews

Jhon Honce %!s(int64=10) %!d(string=hai) anos
pai
achega
557cc0ca9e

+ 11 - 3
bin/cluster

@@ -83,9 +83,10 @@ class Cluster(object):
             sys.stderr.write('RUN [{}]\n'.format(command))
             sys.stderr.flush()
 
-        error = os.system(command)
-        if error != 0:
-            raise Exception("Ansible run failed with exit code %d".format(error))
+        status = os.system(command)
+        if status != 0:
+            sys.stderr.write("RUN [{}] failed with exit status %d".format(command, status))
+            exit(status)
 
 
 
@@ -100,4 +101,11 @@ if __name__ == '__main__':
     parser.add_argument('cluster_id', help='prefix for cluster VM names')
     args = parser.parse_args()
 
+    if 'terminate' == args.action:
+        sys.stderr.write("This will terminate the ENTIRE {} environment. Are you sure? [y/N] ".format(args.cluster_id))
+        sys.stderr.flush()
+        answer = sys.stdin.read(1)
+        if answer not in ['y', 'Y']:
+            exit(0)
+
     Cluster(args).apply()

+ 1 - 1
playbooks/gce/openshift-cluster/launch_instances.yml

@@ -12,7 +12,7 @@
     pem_file: "{{ lookup('env', 'gce_service_account_pem_file_path') }}"
     project_id: "{{ lookup('env', 'gce_project_id') }}"
     tags:
-      - "created-by-{{ cluster }}"
+      - "created-by-{{ lookup('env', 'LOGNAME') |default(cluster, true) }}"
       - "env-{{ cluster }}"
       - "host-type-{{ type }}"
       - "env-host-type-{{ cluster }}-openshift-{{ type }}"

+ 1 - 0
playbooks/gce/openshift-master/terminate.yml

@@ -15,6 +15,7 @@
 - name: Terminate master instances
   hosts: localhost
   connection: local
+  gather_facts: no
   tasks:
     - name: Terminate master instances
       gce:

+ 1 - 0
playbooks/gce/openshift-node/terminate.yml

@@ -15,6 +15,7 @@
 - name: Terminate node instances
   hosts: localhost
   connection: local
+  gather_facts: no
   tasks:
     - name: Terminate node instances
       gce: