mirror of
https://github.com/kevingruesser/bootstrap-vz.git
synced 2025-08-22 09:50:37 +00:00
flake8 fixes: correct some indentations
This commit is contained in:
parent
4dcd1e2f6a
commit
bfe2d1f3ba
6 changed files with 56 additions and 56 deletions
|
@ -189,7 +189,7 @@ def get_all_classes(path=None, prefix='', excludes=[]):
|
|||
for class_name, obj in classes:
|
||||
# We only want classes that are defined in the module, and not imported ones
|
||||
if obj.__module__ == module_name:
|
||||
yield obj
|
||||
yield obj
|
||||
|
||||
|
||||
def check_ordering(task):
|
||||
|
|
|
@ -100,7 +100,7 @@ class AddManifestPreferences(Task):
|
|||
@classmethod
|
||||
def run(cls, info):
|
||||
for name, preferences in info.manifest.packages['preferences'].iteritems():
|
||||
info.preference_lists.add(name, preferences)
|
||||
info.preference_lists.add(name, preferences)
|
||||
|
||||
|
||||
class InstallTrustedKeys(Task):
|
||||
|
|
|
@ -104,20 +104,20 @@ class CreateFromFolder(Task):
|
|||
|
||||
|
||||
def set_fs_states(vol):
|
||||
vol.fsm.current = 'detached'
|
||||
vol.fsm.current = 'detached'
|
||||
|
||||
p_map = vol.partition_map
|
||||
from bootstrapvz.base.fs.partitionmaps.none import NoPartitions
|
||||
if not isinstance(p_map, NoPartitions):
|
||||
p_map.fsm.current = 'unmapped'
|
||||
p_map = vol.partition_map
|
||||
from bootstrapvz.base.fs.partitionmaps.none import NoPartitions
|
||||
if not isinstance(p_map, NoPartitions):
|
||||
p_map.fsm.current = 'unmapped'
|
||||
|
||||
from bootstrapvz.base.fs.partitions.unformatted import UnformattedPartition
|
||||
from bootstrapvz.base.fs.partitions.single import SinglePartition
|
||||
for partition in p_map.partitions:
|
||||
if isinstance(partition, UnformattedPartition):
|
||||
partition.fsm.current = 'unmapped'
|
||||
continue
|
||||
if isinstance(partition, SinglePartition):
|
||||
partition.fsm.current = 'formatted'
|
||||
continue
|
||||
partition.fsm.current = 'unmapped_fmt'
|
||||
from bootstrapvz.base.fs.partitions.unformatted import UnformattedPartition
|
||||
from bootstrapvz.base.fs.partitions.single import SinglePartition
|
||||
for partition in p_map.partitions:
|
||||
if isinstance(partition, UnformattedPartition):
|
||||
partition.fsm.current = 'unmapped'
|
||||
continue
|
||||
if isinstance(partition, SinglePartition):
|
||||
partition.fsm.current = 'formatted'
|
||||
continue
|
||||
partition.fsm.current = 'unmapped_fmt'
|
||||
|
|
|
@ -35,19 +35,19 @@ def validate_manifest(data, validator, error):
|
|||
error('Paravirtualized AMIs only support pvgrub as a bootloader', ['system', 'bootloader'])
|
||||
|
||||
if backing != 'ebs' and virtualization == 'hvm':
|
||||
error('HVM AMIs currently only work when they are EBS backed', ['volume', 'backing'])
|
||||
error('HVM AMIs currently only work when they are EBS backed', ['volume', 'backing'])
|
||||
|
||||
if backing == 's3' and partition_type != 'none':
|
||||
error('S3 backed AMIs currently only work with unpartitioned volumes', ['system', 'bootloader'])
|
||||
error('S3 backed AMIs currently only work with unpartitioned volumes', ['system', 'bootloader'])
|
||||
|
||||
if backing != 'ebs' and encrypted:
|
||||
error('Encryption is supported only on EBS volumes')
|
||||
error('Encryption is supported only on EBS volumes')
|
||||
|
||||
if encrypted is False and kms_key_id is not None:
|
||||
error('KMS Key Id can be set only when encryption is enabled')
|
||||
error('KMS Key Id can be set only when encryption is enabled')
|
||||
|
||||
if enhanced_networking == 'simple' and virtualization != 'hvm':
|
||||
error('Enhanced networking only works with HVM virtualization', ['provider', 'virtualization'])
|
||||
error('Enhanced networking only works with HVM virtualization', ['provider', 'virtualization'])
|
||||
|
||||
|
||||
def resolve_tasks(taskset, manifest):
|
||||
|
|
|
@ -23,7 +23,7 @@ def prepare_bootstrap(manifest, build_server):
|
|||
bucket.delete_key(item.key)
|
||||
s3_connection.delete_bucket(manifest.image['bucket'])
|
||||
else:
|
||||
yield
|
||||
yield
|
||||
|
||||
|
||||
@contextmanager
|
||||
|
|
|
@ -46,42 +46,42 @@ def waituntil(predicate, timeout=5, interval=0.05):
|
|||
|
||||
|
||||
def read_from_socket(socket_path, termination_string, timeout, read_timeout=0.5):
|
||||
import socket
|
||||
import select
|
||||
import errno
|
||||
console = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
|
||||
console.connect(socket_path)
|
||||
console.setblocking(0)
|
||||
import socket
|
||||
import select
|
||||
import errno
|
||||
console = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
|
||||
console.connect(socket_path)
|
||||
console.setblocking(0)
|
||||
|
||||
from timeit import default_timer
|
||||
start = default_timer()
|
||||
from timeit import default_timer
|
||||
start = default_timer()
|
||||
|
||||
output = ''
|
||||
ptr = 0
|
||||
continue_select = True
|
||||
while continue_select:
|
||||
read_ready, _, _ = select.select([console], [], [], read_timeout)
|
||||
if console in read_ready:
|
||||
while True:
|
||||
try:
|
||||
output += console.recv(1024)
|
||||
if termination_string in output[ptr:]:
|
||||
continue_select = False
|
||||
else:
|
||||
ptr = len(output) - len(termination_string)
|
||||
break
|
||||
except socket.error, e:
|
||||
if e.errno != errno.EWOULDBLOCK:
|
||||
raise Exception(e)
|
||||
output = ''
|
||||
ptr = 0
|
||||
continue_select = True
|
||||
while continue_select:
|
||||
read_ready, _, _ = select.select([console], [], [], read_timeout)
|
||||
if console in read_ready:
|
||||
while True:
|
||||
try:
|
||||
output += console.recv(1024)
|
||||
if termination_string in output[ptr:]:
|
||||
continue_select = False
|
||||
if default_timer() - start > timeout:
|
||||
from .exceptions import SocketReadTimeout
|
||||
msg = ('Reading from socket `{path}\' timed out after {seconds} seconds.\n'
|
||||
'Here is the output so far:\n{output}'
|
||||
.format(path=socket_path, seconds=timeout, output=output))
|
||||
raise SocketReadTimeout(msg)
|
||||
console.close()
|
||||
return output
|
||||
else:
|
||||
ptr = len(output) - len(termination_string)
|
||||
break
|
||||
except socket.error, e:
|
||||
if e.errno != errno.EWOULDBLOCK:
|
||||
raise Exception(e)
|
||||
continue_select = False
|
||||
if default_timer() - start > timeout:
|
||||
from .exceptions import SocketReadTimeout
|
||||
msg = ('Reading from socket `{path}\' timed out after {seconds} seconds.\n'
|
||||
'Here is the output so far:\n{output}'
|
||||
.format(path=socket_path, seconds=timeout, output=output))
|
||||
raise SocketReadTimeout(msg)
|
||||
console.close()
|
||||
return output
|
||||
|
||||
|
||||
@contextmanager
|
||||
|
|
Loading…
Add table
Reference in a new issue