AMBARI-25473 Upgrade Infra Solr Clients fails if it is installed on only one host... master
authorSzilard Antal <santal@cloudera.com>
Mon, 10 Feb 2020 10:36:18 +0000 (11:36 +0100)
committerOliver Szabo <oleewere@gmail.com>
Mon, 10 Feb 2020 10:36:18 +0000 (11:36 +0100)
ambari-infra-solr-client/src/main/python/migrationHelper.py

index e44044cc80794be0af72ae60743915d2a67c33cb..a257b34afacc3e2c8fcb558638f3de554b7c9d72 100755 (executable)
@@ -508,6 +508,11 @@ def upgrade_solr_clients(options, accessor, parser, config):
   host = socket.gethostname()
   if host in solr_client_hosts:
     solr_client_hosts.remove(host)
+
+  if not len(solr_client_hosts):
+    print 'The Solr Clients upgrade request has been aborted because no other host can be upgraded.'
+    sys.exit(0)
+
   context = "Upgrade Solr Clients"
   sys.stdout.write("Sending upgrade request: [{0}] ".format(context))
   sys.stdout.flush()
@@ -2078,4 +2083,4 @@ if __name__=="__main__":
       print 30 * "-"
       print "Command elapsed time: {0}".format(time_to_print)
       print 30 * "-"
-      print "Migration helper command {0}FINISHED{1}".format(colors.OKGREEN, colors.ENDC)
\ No newline at end of file
+      print "Migration helper command {0}FINISHED{1}".format(colors.OKGREEN, colors.ENDC)