summaryrefslogtreecommitdiffstats
path: root/base/server/sbin
diff options
context:
space:
mode:
authorChristian Heimes <cheimes@redhat.com>2015-08-11 20:55:48 +0200
committerChristian Heimes <cheimes@redhat.com>2015-08-14 13:03:18 +0200
commit12badcabc1cd345256a4902f7b0583cf667ecd8d (patch)
treed0a45d096fab9c0b14d5221557a616824ecfd24a /base/server/sbin
parentd63ade55f5cc2a9ecf21ea2b43cfac80149c4c29 (diff)
Make pki PEP 8 compatible
Large portions of the patch was automatically created with autopep8: find base/ -name '*.py' | xargs autopep8 --in-place --ignore E309 \ --aggressive find base/common/upgrade base/server/upgrade -type f -and \ -not -name .gitignore | autopep8 --in-place --ignore E309 --aggressive autopep8 --in-place --ignore E309 --aggressive \ base/common/sbin/pki-upgrade \ base/server/sbin/pkispawn \ base/server/sbin/pkidestroy \ base/server/sbin/pki-server \ base/server/sbin/pki-server-upgrade About two dozent violations were fixed manually. https://fedorahosted.org/pki/ticket/708
Diffstat (limited to 'base/server/sbin')
-rw-r--r--base/server/sbin/pki-server7
-rwxr-xr-xbase/server/sbin/pkidestroy6
-rwxr-xr-xbase/server/sbin/pkispawn54
3 files changed, 34 insertions, 33 deletions
diff --git a/base/server/sbin/pki-server b/base/server/sbin/pki-server
index 627a4765e..2afaaa547 100644
--- a/base/server/sbin/pki-server
+++ b/base/server/sbin/pki-server
@@ -32,8 +32,9 @@ import pki.server.cli.nuxwdog
class PKIServerCLI(pki.cli.CLI):
def __init__(self):
-
- super(PKIServerCLI, self).__init__('pki-server', 'PKI server command-line interface')
+ super(PKIServerCLI, self).__init__(
+ 'pki-server',
+ 'PKI server command-line interface')
self.add_module(pki.server.cli.instance.InstanceCLI())
self.add_module(pki.server.cli.subsystem.SubsystemCLI())
@@ -44,7 +45,6 @@ class PKIServerCLI(pki.cli.CLI):
return module_name
def print_help(self):
-
print 'Usage: pki-server [OPTIONS]'
print
print ' -v, --verbose Run in verbose mode.'
@@ -55,7 +55,6 @@ class PKIServerCLI(pki.cli.CLI):
super(PKIServerCLI, self).print_help()
def execute(self, argv):
-
try:
opts, args = getopt.getopt(argv[1:], 'v', [
'verbose', 'debug', 'help'])
diff --git a/base/server/sbin/pkidestroy b/base/server/sbin/pkidestroy
index abc11dc8d..fa5232e10 100755
--- a/base/server/sbin/pkidestroy
+++ b/base/server/sbin/pkidestroy
@@ -45,11 +45,11 @@ There was a problem importing one of the required Python modules. The
error was:
%s
-""" % sys.exc_value
+""" % sys.exc_info()[1]
sys.exit(1)
-#Handle the Keyboard Interrupt
+# Handle the Keyboard Interrupt
# pylint: disable=W0613
def interrupt_handler(event, frame):
print
@@ -114,7 +114,7 @@ def main(argv):
action='store',
nargs=1, metavar='<security domain user>',
help='security domain user')
-
+
parser.optional.add_argument(
'-W',
dest='pki_secdomain_pass_file',
diff --git a/base/server/sbin/pkispawn b/base/server/sbin/pkispawn
index fb5a61a8f..760febee2 100755
--- a/base/server/sbin/pkispawn
+++ b/base/server/sbin/pkispawn
@@ -48,7 +48,7 @@ There was a problem importing one of the required Python modules. The
error was:
%s
-""" % sys.exc_value
+""" % sys.exc_info()[1]
sys.exit(1)
@@ -116,7 +116,8 @@ def main(argv):
# -f <user deployment config>
if args.user_deployment_cfg is not None:
- config.user_deployment_cfg = str(args.user_deployment_cfg).strip('[\']')
+ config.user_deployment_cfg = str(
+ args.user_deployment_cfg).strip('[\']')
parser.validate()
interactive = False
@@ -234,22 +235,22 @@ def main(argv):
# print "Interactive HSM installation is currently unsupported."
# sys.exit(0)
- # TBD: Interactive HSM installation
- # parser.set_property(config.pki_subsystem,
- # 'pki_hsm_enable',
- # 'True')
- # modulename = parser.read_text(
- # 'HSM Module Name (e. g. - nethsm)', allow_empty=False)
- # parser.set_property(config.pki_subsystem,
- # 'pki_hsm_modulename',
- # modulename)
- # libfile = parser.read_text(
- # 'HSM Lib File ' +
- # '(e. g. - /opt/nfast/toolkits/pkcs11/libcknfast.so)',
- # allow_empty=False)
- # parser.set_property(config.pki_subsystem,
- # 'pki_hsm_libfile',
- # libfile)
+ # TBD: Interactive HSM installation
+ # parser.set_property(config.pki_subsystem,
+ # 'pki_hsm_enable',
+ # 'True')
+ # modulename = parser.read_text(
+ # 'HSM Module Name (e. g. - nethsm)', allow_empty=False)
+ # parser.set_property(config.pki_subsystem,
+ # 'pki_hsm_modulename',
+ # modulename)
+ # libfile = parser.read_text(
+ # 'HSM Lib File ' +
+ # '(e. g. - /opt/nfast/toolkits/pkcs11/libcknfast.so)',
+ # allow_empty=False)
+ # parser.set_property(config.pki_subsystem,
+ # 'pki_hsm_libfile',
+ # libfile)
# print
print "Directory Server:"
@@ -415,7 +416,7 @@ def main(argv):
parser.set_property(config.pki_subsystem,
'pki_enable_server_side_keygen',
'True')
-
+
parser.read_text('KRA URL',
config.pki_subsystem,
'pki_kra_uri')
@@ -487,7 +488,8 @@ def main(argv):
sys.exit(1)
# Enable 'pkispawn' logging.
- config.pki_log_dir = config.pki_root_prefix + config.PKI_DEPLOYMENT_LOG_ROOT
+ config.pki_log_dir = config.pki_root_prefix + \
+ config.PKI_DEPLOYMENT_LOG_ROOT
config.pki_log_name = "pki" + "-" + \
config.pki_subsystem.lower() + \
"-" + "spawn" + "." + \
@@ -533,7 +535,7 @@ def main(argv):
not config.str2bool(parser.mdict['pki_skip_configuration']):
try:
# Verify existence of Directory Server Password
- if not 'pki_ds_password' in parser.mdict or\
+ if 'pki_ds_password' not in parser.mdict or\
not len(parser.mdict['pki_ds_password']):
config.pki_log.error(
log.PKIHELPER_UNDEFINED_CONFIGURATION_FILE_ENTRY_2,
@@ -557,7 +559,7 @@ def main(argv):
if parser.mdict['pki_security_domain_type'] != "new":
try:
# Verify existence of Security Domain Password
- if not 'pki_security_domain_password' in parser.mdict or\
+ if 'pki_security_domain_password' not in parser.mdict or\
not len(parser.mdict['pki_security_domain_password']):
config.pki_log.error(
log.PKIHELPER_UNDEFINED_CONFIGURATION_FILE_ENTRY_2,
@@ -643,10 +645,10 @@ def print_install_information(mdict):
% mdict['pki_client_database_dir']
print log.PKI_CHECK_STATUS_MESSAGE % mdict['pki_instance_name']
print log.PKI_INSTANCE_RESTART_MESSAGE % mdict['pki_instance_name']
- if (((config.pki_subsystem == "KRA" or\
- config.pki_subsystem == "OCSP") and\
- config.str2bool(mdict['pki_standalone'])) and\
- not config.str2bool(mdict['pki_external_step_two'])):
+ if (((config.pki_subsystem == "KRA" or
+ config.pki_subsystem == "OCSP") and
+ config.str2bool(mdict['pki_standalone'])) and
+ not config.str2bool(mdict['pki_external_step_two'])):
# Stand-alone PKI KRA/OCSP (External CA Step 1)
print log.PKI_CONFIGURATION_STANDALONE_1 % config.pki_subsystem
else: