From 85f1a8c956ffdab63ea37528ecdf2684bc53a73f Mon Sep 17 00:00:00 2001 From: Brian Lin Date: Thu, 23 Jun 2016 16:37:37 -0500 Subject: [PATCH 1/4] Remove extraneous newlines in option help text --- osgpkitools/osg-cert-request | 3 +-- osgpkitools/osg-user-cert-renew | 4 ++-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/osgpkitools/osg-cert-request b/osgpkitools/osg-cert-request index ba36af1..eca6956 100755 --- a/osgpkitools/osg-cert-request +++ b/osgpkitools/osg-cert-request @@ -48,8 +48,7 @@ def parse_args(): '--outkeyfile', action='store', dest='keyfile', - help='Specify the output filename for the retrieved user certificate.\ - \nDefault is ./hostkey.pem', + help='Specify the output filename for the retrieved user certificate. Default is ./hostkey.pem', metavar='OUTPUT KEYFILE', default='hostkey.pem', ) diff --git a/osgpkitools/osg-user-cert-renew b/osgpkitools/osg-user-cert-renew index b3a43dc..169cd76 100755 --- a/osgpkitools/osg-user-cert-renew +++ b/osgpkitools/osg-user-cert-renew @@ -53,8 +53,8 @@ def parse_args(): '--cert', action='store', dest='usercert', - help="Specify Requestor's certificate (PEM Format).\n If not specified\ - will take the value of X509_USER_CERT or $HOME/.globus/usercert.pem", + help="Specify Requestor's certificate (PEM Format). If not specified \ +will take the value of X509_USER_CERT or $HOME/.globus/usercert.pem", default=None, metavar='CERT', ) From 4adf10968aeb279513da2a56bc284f1995c674e4 Mon Sep 17 00:00:00 2001 From: Brian Lin Date: Thu, 23 Jun 2016 16:45:00 -0500 Subject: [PATCH 2/4] Fix spacing on usage text --- osgpkitools/osg-gridadmin-cert-request | 2 +- osgpkitools/osg-user-cert-renew | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/osgpkitools/osg-gridadmin-cert-request b/osgpkitools/osg-gridadmin-cert-request index d80704d..1adcba1 100755 --- a/osgpkitools/osg-gridadmin-cert-request +++ b/osgpkitools/osg-gridadmin-cert-request @@ -48,7 +48,7 @@ def parse_args(): in a dictionary that is used throughout the script.""" usage = \ - 'usage: %prog [options] arg\nUsage:%prog -h/--help [for detailed explanations of options]' + 'usage: %prog [options] arg\nUsage: %prog -h/--help [for detailed explanations of options]' parser = OptionParser(usage) group = OptionGroup(parser, 'Hostname Options', '''Use either of these options. diff --git a/osgpkitools/osg-user-cert-renew b/osgpkitools/osg-user-cert-renew index 169cd76..91acfe2 100755 --- a/osgpkitools/osg-user-cert-renew +++ b/osgpkitools/osg-user-cert-renew @@ -36,7 +36,7 @@ def parse_args(): in a dictionary that is used throughout the script.""" usage = \ - 'usage: %prog [options]\nUsage:%prog -h/--help [for detailed explanations of options]' + 'usage: %prog [options]\nUsage: %prog -h/--help [for detailed explanations of options]' parser = OptionParser(usage) parser.add_option( '-k', From dd521c37d2d4bdf4c5936a0114a098f388c53e15 Mon Sep 17 00:00:00 2001 From: Brian Lin Date: Wed, 10 Aug 2016 13:18:27 -0500 Subject: [PATCH 3/4] Reword bad VO info error from osg-*-cert-request (SOFTWARE-2405) --- osgpkitools/OSGPKIUtils.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/osgpkitools/OSGPKIUtils.py b/osgpkitools/OSGPKIUtils.py index b61d9e8..09cd7bc 100644 --- a/osgpkitools/OSGPKIUtils.py +++ b/osgpkitools/OSGPKIUtils.py @@ -152,7 +152,9 @@ def print_failure_reason_exit(data): # provide a VO in their request. We cannot handle this in the arg parsing # because not all domains require VO information (SOFTWARE-2292) if re.search(r'Couldn\'t find GridAdmin group under specified VO', msg): - msg = "Failed to request certificate due to missing VO information. Did you forget to specify the -v/--vo option?" + msg = "Failed to request certificate due to bad VO information. " + \ + "Did you specify an acceptable VO for your requested domain? " + \ + "See http://oim.opensciencegrid.org/oim/gridadmin for a list of VOs per domain" separator = '='*80 sys.exit('\n'.join(textwrap.wrap(separator + msg, width=80))) From 09f16e98a73933ca96701b3b826ef4a807c72dbf Mon Sep 17 00:00:00 2001 From: Brian Lin Date: Thu, 11 Aug 2016 16:24:18 -0500 Subject: [PATCH 4/4] Drop verification of error message in favor of exception type --- tests/OSGPKIUtilsTests.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/tests/OSGPKIUtilsTests.py b/tests/OSGPKIUtilsTests.py index cdede7c..56a9a6f 100644 --- a/tests/OSGPKIUtilsTests.py +++ b/tests/OSGPKIUtilsTests.py @@ -56,7 +56,7 @@ def test_sigalrm_handler(self): '''Verify exiting handler''' self.assertRaises(SystemExit, OSGPKIUtils.start_timeout_clock, 0) - def test_missing_vo_msg(self): + def test_missing_vo_exception(self): '''Verify helpful error message when user fails to include necessary VO information.''' response = dumps({'status': 'FAILED', 'detail': ' -- '.join(["Failed to find GridAdmins for specified CSRs/VO", @@ -66,11 +66,8 @@ def test_missing_vo_msg(self): "https://ticket.grid.iu.edu"])}) try: OSGPKIUtils.print_failure_reason_exit(response) - except SystemExit, exc: - self.assertEqual(exc.message.replace('\n', ' '), - "="*80 + " Failed to request certificate due to missing VO information. " + \ - "Did you forget to specify the -v/--vo option?")#, - # "print_failure_reason_exit() did not fail with missing VO error message") + except SystemExit: + pass else: self.fail("print_failure_reason_exit() did not raise SystemExit")