You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by ol...@apache.org on 2018/05/17 01:09:12 UTC

[ambari] branch trunk updated: AMBARI-23822. Migration Helper: handle if action option is missing

This is an automated email from the ASF dual-hosted git repository.

oleewere pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/ambari.git


The following commit(s) were added to refs/heads/trunk by this push:
     new fc5aee4  AMBARI-23822. Migration Helper: handle if action option is missing
fc5aee4 is described below

commit fc5aee4f70d5051183417942cf306b45a3fc82b7
Author: Oliver Szabo <ol...@gmail.com>
AuthorDate: Thu May 17 03:04:56 2018 +0200

    AMBARI-23822. Migration Helper: handle if action option is missing
---
 .../src/main/python/migrationHelper.py             | 29 +++++++++++-----------
 1 file changed, 15 insertions(+), 14 deletions(-)

diff --git a/ambari-infra/ambari-infra-solr-client/src/main/python/migrationHelper.py b/ambari-infra/ambari-infra-solr-client/src/main/python/migrationHelper.py
index 4566479..2226346 100755
--- a/ambari-infra/ambari-infra-solr-client/src/main/python/migrationHelper.py
+++ b/ambari-infra/ambari-infra-solr-client/src/main/python/migrationHelper.py
@@ -243,18 +243,19 @@ if __name__=="__main__":
   parser.add_option("--solr-keep-backup", dest="solr_keep_backup", default=False, action="store_true", help="If it is turned on, Snapshot Solr data will not be deleted from the filesystem during restore.")
 
   (options, args) = parser.parse_args()
-
-  protocol = 'https' if options.ssl else 'http'
-
-  accessor = api_accessor(options.host, options.username, options.password, protocol, options.port)
-
-  print 'Inputs: ' + str(options)
-  if options.action.lower() == 'backup':
-    backup(options, accessor, parser)
-  elif options.action.lower() == 'restore':
-    restore(options, accessor, parser)
-  elif options.action.lower() == 'migrate':
-    migrate(options, accessor, parser)
+  if options.action is None:
+     parser.print_help()
+     print 'action option is missing'
   else:
-    parser.print_help()
-    print 'action option is wrong or missing'
+    protocol = 'https' if options.ssl else 'http'
+    accessor = api_accessor(options.host, options.username, options.password, protocol, options.port)
+    print 'Inputs: ' + str(options)
+    if options.action.lower() == 'backup':
+      backup(options, accessor, parser)
+    elif options.action.lower() == 'restore':
+      restore(options, accessor, parser)
+    elif options.action.lower() == 'migrate':
+      migrate(options, accessor, parser)
+    else:
+      parser.print_help()
+      print 'action option is invalid (available actions: backup | restore | migrate)'

-- 
To stop receiving notification emails like this one, please contact
oleewere@apache.org.