From 51a3e488e3cc4c9fa37520cbd8d2f8900520534e Mon Sep 17 00:00:00 2001 From: Tiago Ilieve Date: Sun, 27 Apr 2014 10:14:02 -0300 Subject: [PATCH] PEP8 fixes --- bootstrapvz/base/fs/__init__.py | 2 +- bootstrapvz/common/__init__.py | 1 - bootstrapvz/common/tasks/apt.py | 8 ++++---- bootstrapvz/common/tasks/filesystem.py | 8 ++++---- bootstrapvz/common/tools.py | 4 ++-- bootstrapvz/plugins/cloud_init/__init__.py | 4 +--- bootstrapvz/plugins/opennebula/__init__.py | 1 - bootstrapvz/plugins/opennebula/tasks.py | 2 +- bootstrapvz/plugins/puppet/tasks.py | 2 +- 9 files changed, 14 insertions(+), 18 deletions(-) diff --git a/bootstrapvz/base/fs/__init__.py b/bootstrapvz/base/fs/__init__.py index b575b87..ca9b1b7 100644 --- a/bootstrapvz/base/fs/__init__.py +++ b/bootstrapvz/base/fs/__init__.py @@ -30,5 +30,5 @@ def load_volume(data, bootloader): 'vmdk': VirtualMachineDisk, 'ebs': EBSVolume } - # Create the volume with the partition map as an argument + # Create the volume with the partition map as an argument return volume_backings.get(data['backing'])(partition_map) diff --git a/bootstrapvz/common/__init__.py b/bootstrapvz/common/__init__.py index f4fa88c..e69de29 100644 --- a/bootstrapvz/common/__init__.py +++ b/bootstrapvz/common/__init__.py @@ -1 +0,0 @@ -from exceptions import * diff --git a/bootstrapvz/common/tasks/apt.py b/bootstrapvz/common/tasks/apt.py index 777f635..d0b9d8f 100644 --- a/bootstrapvz/common/tasks/apt.py +++ b/bootstrapvz/common/tasks/apt.py @@ -26,11 +26,11 @@ class AddDefaultSources(Task): sections = 'main' if 'sections' in info.manifest.system: sections = ' '.join(info.manifest.system['sections']) - info.source_lists.add('main', 'deb {apt_mirror} {system.release} '+sections) - info.source_lists.add('main', 'deb-src {apt_mirror} {system.release} '+sections) + info.source_lists.add('main', 'deb {apt_mirror} {system.release} ' + sections) + info.source_lists.add('main', 'deb-src {apt_mirror} {system.release} ' + sections) if info.release_codename != 'sid': - info.source_lists.add('main', 'deb http://security.debian.org/ {system.release}/updates '+sections) - info.source_lists.add('main', 'deb-src http://security.debian.org/ {system.release}/updates '+sections) + info.source_lists.add('main', 'deb http://security.debian.org/ {system.release}/updates ' + sections) + info.source_lists.add('main', 'deb-src http://security.debian.org/ {system.release}/updates ' + sections) info.source_lists.add('main', 'deb {apt_mirror} {system.release}-updates ' + sections) info.source_lists.add('main', 'deb-src {apt_mirror} {system.release}-updates ' + sections) diff --git a/bootstrapvz/common/tasks/filesystem.py b/bootstrapvz/common/tasks/filesystem.py index 71845f6..482ff3d 100644 --- a/bootstrapvz/common/tasks/filesystem.py +++ b/bootstrapvz/common/tasks/filesystem.py @@ -144,10 +144,10 @@ class FStab(Task): import os.path p_map = info.volume.partition_map mount_points = [{'path': '/', - 'partition': p_map.root, - 'dump': '1', - 'pass_num': '1', - }] + 'partition': p_map.root, + 'dump': '1', + 'pass_num': '1', + }] if hasattr(p_map, 'boot'): mount_points.append({'path': '/boot', 'partition': p_map.boot, diff --git a/bootstrapvz/common/tools.py b/bootstrapvz/common/tools.py index 8721144..2f6a789 100644 --- a/bootstrapvz/common/tools.py +++ b/bootstrapvz/common/tools.py @@ -70,7 +70,8 @@ def config_get(path, config_path): config = config.get(key) return config -def copy_tree(from_path,to_path): + +def copy_tree(from_path, to_path): from shutil import copy import os for abs_prefix, dirs, files in os.walk(from_path): @@ -86,4 +87,3 @@ def copy_tree(from_path,to_path): for path in files: copy(os.path.join(abs_prefix, path), os.path.join(to_path, prefix, path)) - diff --git a/bootstrapvz/plugins/cloud_init/__init__.py b/bootstrapvz/plugins/cloud_init/__init__.py index 3dd8682..e0c17c9 100644 --- a/bootstrapvz/plugins/cloud_init/__init__.py +++ b/bootstrapvz/plugins/cloud_init/__init__.py @@ -14,9 +14,7 @@ def resolve_tasks(taskset, manifest): if manifest.system['release'] in ['wheezy', 'stable']: taskset.add(tasks.AddBackports) - taskset.update([ tasks.SetMetadataSource, - tasks.AddCloudInitPackages, - ]) + taskset.update([tasks.SetMetadataSource, tasks.AddCloudInitPackages]) options = manifest.plugins['cloud_init'] if 'username' in options: diff --git a/bootstrapvz/plugins/opennebula/__init__.py b/bootstrapvz/plugins/opennebula/__init__.py index 4164c31..4ac6056 100644 --- a/bootstrapvz/plugins/opennebula/__init__.py +++ b/bootstrapvz/plugins/opennebula/__init__.py @@ -5,4 +5,3 @@ def resolve_tasks(taskset, manifest): if manifest.system['release'] in ['wheezy', 'stable']: taskset.add(tasks.AddBackports) taskset.update([tasks.AddONEContextPackage]) - diff --git a/bootstrapvz/plugins/opennebula/tasks.py b/bootstrapvz/plugins/opennebula/tasks.py index 202c5a2..410bc90 100644 --- a/bootstrapvz/plugins/opennebula/tasks.py +++ b/bootstrapvz/plugins/opennebula/tasks.py @@ -1,7 +1,6 @@ from bootstrapvz.base import Task from bootstrapvz.common.tasks import apt from bootstrapvz.common import phases -import os class AddBackports(Task): @@ -18,6 +17,7 @@ class AddBackports(Task): info.source_lists.add('backports', 'deb {apt_mirror} {system.release}-backports main') info.source_lists.add('backports', 'deb-src {apt_mirror} {system.release}-backports main') + class AddONEContextPackage(Task): description = 'Adding the OpenNebula context package' phase = phases.preparation diff --git a/bootstrapvz/plugins/puppet/tasks.py b/bootstrapvz/plugins/puppet/tasks.py index dca4cd7..2627e69 100644 --- a/bootstrapvz/plugins/puppet/tasks.py +++ b/bootstrapvz/plugins/puppet/tasks.py @@ -2,6 +2,7 @@ from bootstrapvz.base import Task from bootstrapvz.common import phases from bootstrapvz.common.tasks import apt from bootstrapvz.common.tasks import network +from bootstrapvz.common.tools import sed_i import os @@ -82,7 +83,6 @@ class ApplyPuppetManifest(Task): 'puppet', 'apply', manifest_path]) os.remove(manifest_dst) - from bootstrapvz.common.tools import sed_i hosts_path = os.path.join(info.root, 'etc/hosts') sed_i(hosts_path, '127.0.0.1\s*{hostname}\n?'.format(hostname=hostname), '')