mirror of
https://github.com/kevingruesser/bootstrap-vz.git
synced 2025-08-22 09:50:37 +00:00
pylint len-as-condition
This commit is contained in:
parent
98975cac7b
commit
c068ba07ab
9 changed files with 11 additions and 11 deletions
|
@ -21,7 +21,7 @@ class GPTPartitionMap(AbstractPartitionMap):
|
|||
|
||||
# Returns the last partition unless there is none
|
||||
def last_partition():
|
||||
return self.partitions[-1] if len(self.partitions) > 0 else None
|
||||
return self.partitions[-1] if self.partitions else None
|
||||
|
||||
if bootloader == 'grub':
|
||||
# If we are using the grub bootloader we need to create an unformatted partition
|
||||
|
|
|
@ -23,7 +23,7 @@ class MSDOSPartitionMap(AbstractPartitionMap):
|
|||
|
||||
# Returns the last partition unless there is none
|
||||
def last_partition():
|
||||
return self.partitions[-1] if len(self.partitions) > 0 else None
|
||||
return self.partitions[-1] if self.partitions else None
|
||||
|
||||
# The boot and swap partitions are optional
|
||||
if 'boot' in data:
|
||||
|
|
|
@ -82,11 +82,11 @@ class Source(object):
|
|||
:rtype: str
|
||||
"""
|
||||
options = ''
|
||||
if len(self.options) > 0:
|
||||
if self.options:
|
||||
options = ' [{options}]'.format(options=' '.join(self.options))
|
||||
|
||||
components = ''
|
||||
if len(self.components) > 0:
|
||||
if self.components:
|
||||
components = ' {components}'.format(components=' '.join(self.components))
|
||||
|
||||
return ('{type}{options} {uri} {distribution}{components}'
|
||||
|
|
|
@ -34,7 +34,7 @@ class FSMProxy(object):
|
|||
fn = getattr(fsm, event)
|
||||
|
||||
def proxy(*args, **kwargs):
|
||||
if len(args) > 0:
|
||||
if args:
|
||||
raise FSMProxyError('FSMProxy event listeners only accept named arguments.')
|
||||
fn(**kwargs)
|
||||
return proxy
|
||||
|
|
|
@ -34,9 +34,9 @@ def get_bootstrap_args(info):
|
|||
else:
|
||||
from bootstrapvz.common.exceptions import ManifestError
|
||||
raise ManifestError('force-check-gpg is only support in Stretch and newer releases')
|
||||
if len(info.include_packages) > 0:
|
||||
if info.include_packages:
|
||||
options.append('--include=' + ','.join(info.include_packages))
|
||||
if len(info.exclude_packages) > 0:
|
||||
if info.exclude_packages:
|
||||
options.append('--exclude=' + ','.join(info.exclude_packages))
|
||||
mirror = info.manifest.bootstrapper.get('mirror', info.apt_mirror)
|
||||
arguments = [info.manifest.system['release'], info.root, mirror]
|
||||
|
|
|
@ -211,7 +211,7 @@ class WriteGrubConfig(Task):
|
|||
elif isinstance(value, bool):
|
||||
grub_config_contents += '{}="{}"\n'.format(key, str(value).lower())
|
||||
elif isinstance(value, list):
|
||||
if len(value) > 0:
|
||||
if value:
|
||||
args_list = ' '.join(map(str, value))
|
||||
grub_config_contents += '{}="{}"\n'.format(key, args_list)
|
||||
elif value is not None:
|
||||
|
|
|
@ -30,6 +30,6 @@ class CheckExternalCommands(Task):
|
|||
'it is located in the package `{package}\'.'
|
||||
.format(command=command, package=package))
|
||||
missing_packages.append(msg)
|
||||
if len(missing_packages) > 0:
|
||||
if missing_packages:
|
||||
msg = '\n'.join(missing_packages)
|
||||
raise TaskError(msg)
|
||||
|
|
|
@ -30,7 +30,7 @@ def resolve_tasks(taskset, manifest):
|
|||
options = manifest.plugins['cloud_init']
|
||||
if 'username' in options:
|
||||
taskset.add(tasks.SetUsername)
|
||||
if 'groups' in options and len(options['groups']):
|
||||
if 'groups' in options and options['groups']:
|
||||
taskset.add(tasks.SetGroups)
|
||||
if 'enable_modules' in options:
|
||||
taskset.add(tasks.EnableModules)
|
||||
|
|
|
@ -23,5 +23,5 @@ def resolve_tasks(taskset, manifest):
|
|||
taskset.add(tasks.AddDockerBinary)
|
||||
taskset.add(tasks.AddDockerInit)
|
||||
taskset.add(tasks.EnableMemoryCgroup)
|
||||
if len(manifest.plugins['docker_daemon'].get('pull_images', [])) > 0:
|
||||
if manifest.plugins['docker_daemon'].get('pull_images', []):
|
||||
taskset.add(tasks.PullDockerImages)
|
||||
|
|
Loading…
Add table
Reference in a new issue