From 62bae0115fc702717e18a26c9102237f76a56130 Mon Sep 17 00:00:00 2001 From: Mike Blume Date: Thu, 22 Aug 2013 16:23:58 -0700 Subject: [PATCH 1/3] don't verify right away --- configure-syslog.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/configure-syslog.py b/configure-syslog.py index 0799cf3..f83540e 100644 --- a/configure-syslog.py +++ b/configure-syslog.py @@ -1256,14 +1256,13 @@ def install(current_environment): # 6. SIGHUP the syslog daemon. if user_type == ROOT_USER: - sighup_status = send_sighup_to_syslog(syslog_name_for_configuration) - if sighup_status: - doverify(loggly_user, loggly_password, loggly_subdomain) + send_sighup_to_syslog(syslog_name_for_configuration) Logger.printLog(AUTHTOKEN_MODIFICATION_TEXT % (authorization_details['token'], modified_config_file), print_comp = True, prio = 'debug') Logger.printLog("Installation completed", prio = 'debug') + print("You may verify installation by rerunning with action 'verify'") return syslog_name_for_configuration def verify(current_environment): From e850e700cdb428e2c176c1ec313b83ab5f526e45 Mon Sep 17 00:00:00 2001 From: Mike Blume Date: Thu, 22 Aug 2013 16:31:47 -0700 Subject: [PATCH 2/3] let get_auth_token just return a token caller can wrap it as needed --- configure-syslog.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/configure-syslog.py b/configure-syslog.py index f83540e..fc57ee4 100644 --- a/configure-syslog.py +++ b/configure-syslog.py @@ -854,7 +854,7 @@ def get_auth_token(loggly_user, loggly_password, loggly_subdomain): Logger.printLog(('\nThis system is now configured to use ' '\"%s\" as its Customer Token.\n' % token), print_comp = True) - return { "token" : token, "id": DISTRIBUTION_ID } + return token else: Logger.printLog("Loggly credentials could not be verified.", prio = 'crit', print_comp = True) @@ -1242,8 +1242,8 @@ def install(current_environment): perform_sanity_check_and_get_product_for_configuration(current_environment) loggly_user, loggly_password, loggly_subdomain = login() - authorization_details = get_auth_token(loggly_user, - loggly_password, loggly_subdomain) + token = get_auth_token(loggly_user, loggly_password, loggly_subdomain) + authorization_details = {'token': token, 'id': DISTRIBUTION_ID} # 4. If possible, determine the location of the syslog.conf file or #the syslog.conf.d/ directory. # Provide the location as the default and prompt the user for confirmation. From 16487f01a3de3de53a999e1349a7e6a1d2334808 Mon Sep 17 00:00:00 2001 From: Mike Blume Date: Thu, 22 Aug 2013 16:32:39 -0700 Subject: [PATCH 3/3] add --token option skips login --- configure-syslog.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/configure-syslog.py b/configure-syslog.py index fc57ee4..39e55b9 100644 --- a/configure-syslog.py +++ b/configure-syslog.py @@ -1241,8 +1241,12 @@ def install(current_environment): syslog_name_for_configuration = \ perform_sanity_check_and_get_product_for_configuration(current_environment) - loggly_user, loggly_password, loggly_subdomain = login() - token = get_auth_token(loggly_user, loggly_password, loggly_subdomain) + options = current_environment['options'] + if options.token: + token = options.token + else: + loggly_user, loggly_password, loggly_subdomain = login() + token = get_auth_token(loggly_user, loggly_password, loggly_subdomain) authorization_details = {'token': token, 'id': DISTRIBUTION_ID} # 4. If possible, determine the location of the syslog.conf file or #the syslog.conf.d/ directory. @@ -1366,6 +1370,7 @@ def parse_options(): 'sysinfo', 'loggly_help', 'dryrun')) parser.add_option("-v", "--verbose", action="store_true", dest="verbose", default=False) + parser.add_option("-t", "--token") (options, args) = parser.parse_args() return options @@ -1383,6 +1388,7 @@ def main(): sys.exit() current_environment = get_environment_details() + current_environment['options'] = options data = json.dumps({ "operating_system": current_environment['operating_system'], "syslog_versions": current_environment['syslog_versions']