whitespace / indentation cleanups

These changes were pulled out of the previous merge (cc_yum_add_repo)
as they were unrelated there.  Re-applying them here.
This commit is contained in:
Scott Moser 2012-11-10 22:32:49 -05:00
parent 3b057caa8b
commit 17714831d6
5 changed files with 26 additions and 27 deletions

View File

@ -320,11 +320,9 @@ class Distro(object):
raise e
util.ensure_dir(path, 0750)
def write_sudo_rules(self,
user,
rules,
sudo_file="/etc/sudoers.d/90-cloud-init-users",
):
def write_sudo_rules(self, user, rules, sudo_file=None):
if not sudo_file:
sudo_file = "/etc/sudoers.d/90-cloud-init-users"
content_header = "# user rules for %s" % user
content = "%s\n%s %s\n\n" % (content_header, user, rules)

View File

@ -1193,8 +1193,7 @@ def yaml_dumps(obj):
indent=4,
explicit_start=True,
explicit_end=True,
default_flow_style=False,
)
default_flow_style=False)
return formatted

View File

@ -37,11 +37,13 @@ class TestSimpleRun(helpers.FilesystemMockingTestCase):
self.replicateTestRoot('simple_ubuntu', new_root)
cfg = {
'datasource_list': ['None'],
'write_files': [{
'write_files': [
{
'path': '/etc/blah.ini',
'content': 'blah',
'permissions': 0755,
}],
},
],
'cloud_init_modules': ['write-files'],
}
cloud_cfg = util.yaml_dumps(cfg)

View File

@ -66,8 +66,8 @@ def cloud_import_alphabetical(physical_line, line_number, lines):
# handle import x
# use .lower since capitalization shouldn't dictate order
split_line = import_normalize(physical_line.strip()).lower().split()
split_previous = import_normalize(lines[line_number - 2]
).strip().lower().split()
split_previous = import_normalize(lines[line_number - 2])
split_previous = split_previous.strip().lower().split()
# with or without "as y"
length = [2, 4]
if (len(split_line) in length and len(split_previous) in length and