mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
less pylint: salt/utils/parsers.py
This commit is contained in:
parent
9e7d9dcc78
commit
ab68524d7a
1 changed files with 19 additions and 34 deletions
|
@ -390,8 +390,7 @@ class SaltfileMixIn(six.with_metaclass(MixInMeta, object)):
|
|||
|
||||
if not os.path.isfile(self.options.saltfile):
|
||||
self.error(
|
||||
'\'{0}\' file does not exist.\n'.format(self.options.saltfile
|
||||
)
|
||||
'\'{0}\' file does not exist.\n'.format(self.options.saltfile)
|
||||
)
|
||||
|
||||
# Make sure we have an absolute path
|
||||
|
@ -560,11 +559,10 @@ class LogLevelMixIn(six.with_metaclass(MixInMeta, object)):
|
|||
'-l', '--log-level',
|
||||
dest=self._loglevel_config_setting_name_,
|
||||
choices=list(log.LOG_LEVELS),
|
||||
help='Console logging log level. One of {0}. '
|
||||
'Default: \'{1}\'.'.format(
|
||||
', '.join([repr(l) for l in log.SORTED_LEVEL_NAMES]),
|
||||
self._default_logging_level_
|
||||
)
|
||||
help='Console logging log level. One of {0}. Default: \'{1}\'.'.format(
|
||||
', '.join([repr(l) for l in log.SORTED_LEVEL_NAMES]),
|
||||
self._default_logging_level_
|
||||
)
|
||||
)
|
||||
|
||||
group.add_option(
|
||||
|
@ -580,11 +578,10 @@ class LogLevelMixIn(six.with_metaclass(MixInMeta, object)):
|
|||
'--log-file-level',
|
||||
dest=self._logfile_loglevel_config_setting_name_,
|
||||
choices=list(log.LOG_LEVELS),
|
||||
help='Logfile logging log level. One of {0}. '
|
||||
'Default: \'{1}\'.'.format(
|
||||
', '.join([repr(l) for l in log.SORTED_LEVEL_NAMES]),
|
||||
self._default_logging_level_
|
||||
)
|
||||
help='Logfile logging log level. One of {0}. Default: \'{1}\'.'.format(
|
||||
', '.join([repr(l) for l in log.SORTED_LEVEL_NAMES]),
|
||||
self._default_logging_level_
|
||||
)
|
||||
)
|
||||
|
||||
def process_log_level(self):
|
||||
|
@ -594,15 +591,13 @@ class LogLevelMixIn(six.with_metaclass(MixInMeta, object)):
|
|||
# Is the regular log level setting set?
|
||||
setattr(self.options,
|
||||
self._loglevel_config_setting_name_,
|
||||
self.config.get(self._loglevel_config_setting_name_)
|
||||
)
|
||||
self.config.get(self._loglevel_config_setting_name_))
|
||||
else:
|
||||
# Nothing is set on the configuration? Let's use the CLI tool
|
||||
# defined default
|
||||
setattr(self.options,
|
||||
self._loglevel_config_setting_name_,
|
||||
self._default_logging_level_
|
||||
)
|
||||
self._default_logging_level_)
|
||||
|
||||
# Setup extended logging right before the last step
|
||||
self._mixin_after_parsed_funcs.append(self.__setup_extended_logging)
|
||||
|
@ -622,15 +617,13 @@ class LogLevelMixIn(six.with_metaclass(MixInMeta, object)):
|
|||
# Is the regular log file setting set?
|
||||
setattr(self.options,
|
||||
self._logfile_config_setting_name_,
|
||||
self.config.get(self._logfile_config_setting_name_)
|
||||
)
|
||||
self.config.get(self._logfile_config_setting_name_))
|
||||
else:
|
||||
# Nothing is set on the configuration? Let's use the CLI tool
|
||||
# defined default
|
||||
setattr(self.options,
|
||||
self._logfile_config_setting_name_,
|
||||
self._default_logging_logfile_
|
||||
)
|
||||
self._default_logging_logfile_)
|
||||
if self._logfile_config_setting_name_ in self.config:
|
||||
# Remove it from config so it inherits from log_file
|
||||
self.config.pop(self._logfile_config_setting_name_)
|
||||
|
@ -642,8 +635,7 @@ class LogLevelMixIn(six.with_metaclass(MixInMeta, object)):
|
|||
# Is the regular log file level setting set?
|
||||
setattr(self.options,
|
||||
self._logfile_loglevel_config_setting_name_,
|
||||
self.config.get(self._logfile_loglevel_config_setting_name_)
|
||||
)
|
||||
self.config.get(self._logfile_loglevel_config_setting_name_))
|
||||
else:
|
||||
# Nothing is set on the configuration? Let's use the CLI tool
|
||||
# defined default
|
||||
|
@ -653,8 +645,7 @@ class LogLevelMixIn(six.with_metaclass(MixInMeta, object)):
|
|||
self.config.get(
|
||||
self._loglevel_config_setting_name_,
|
||||
self._default_logging_level_
|
||||
)
|
||||
)
|
||||
))
|
||||
if self._logfile_loglevel_config_setting_name_ in self.config:
|
||||
# Remove it from config so it inherits from log_level_logfile
|
||||
self.config.pop(self._logfile_loglevel_config_setting_name_)
|
||||
|
@ -928,12 +919,6 @@ class DaemonMixIn(six.with_metaclass(MixInMeta, object)):
|
|||
Check if a pid file exists and if it is associated with
|
||||
a running process.
|
||||
'''
|
||||
# There is no os.getppid method for windows
|
||||
if salt.utils.is_windows():
|
||||
from salt.utils.win_functions import get_parent_pid
|
||||
ppid = get_parent_pid()
|
||||
else:
|
||||
ppid = os.getppid()
|
||||
|
||||
if self.check_pidfile():
|
||||
pid = self.get_pidfile()
|
||||
|
@ -1546,9 +1531,9 @@ class CloudQueriesMixIn(six.with_metaclass(MixInMeta, object)):
|
|||
|
||||
def _mixin_after_parsed(self):
|
||||
group_options_selected = [
|
||||
option for option in self.cloud_queries_group.option_list if
|
||||
getattr(self.options, option.dest) is not False and
|
||||
getattr(self.options, option.dest) is not None
|
||||
option for option in self.cloud_queries_group.option_list if
|
||||
getattr(self.options, option.dest) is not False and
|
||||
getattr(self.options, option.dest) is not None
|
||||
]
|
||||
if len(group_options_selected) > 1:
|
||||
self.error(
|
||||
|
@ -2995,7 +2980,7 @@ class SaltCloudParser(six.with_metaclass(OptionParserMeta,
|
|||
description = (
|
||||
'Salt Cloud is the system used to provision virtual machines on various public\n'
|
||||
'clouds via a cleanly controlled profile and mapping system'
|
||||
)
|
||||
)
|
||||
|
||||
usage = '%prog [options] <-m MAP | -p PROFILE> <NAME> [NAME2 ...]'
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue