revert unrelated whitespace changes that creeped in.

This commit is contained in:
Scott Moser 2012-11-10 22:24:01 -05:00
parent 49d5c95435
commit 4efa9ddb09
5 changed files with 27 additions and 26 deletions

View File

@ -187,23 +187,23 @@ class Distro(object):
# inputs. If something goes wrong, we can end up with a system # inputs. If something goes wrong, we can end up with a system
# that nobody can login to. # that nobody can login to.
adduser_opts = { adduser_opts = {
"gecos": '--comment', "gecos": '--comment',
"homedir": '--home', "homedir": '--home',
"primary_group": '--gid', "primary_group": '--gid',
"groups": '--groups', "groups": '--groups',
"passwd": '--password', "passwd": '--password',
"shell": '--shell', "shell": '--shell',
"expiredate": '--expiredate', "expiredate": '--expiredate',
"inactive": '--inactive', "inactive": '--inactive',
"selinux_user": '--selinux-user', "selinux_user": '--selinux-user',
} }
adduser_opts_flags = { adduser_opts_flags = {
"no_user_group": '--no-user-group', "no_user_group": '--no-user-group',
"system": '--system', "system": '--system',
"no_log_init": '--no-log-init', "no_log_init": '--no-log-init',
"no_create_home": "-M", "no_create_home": "-M",
} }
# Now check the value and create the command # Now check the value and create the command
for option in kwargs: for option in kwargs:
@ -320,9 +320,11 @@ class Distro(object):
raise e raise e
util.ensure_dir(path, 0750) util.ensure_dir(path, 0750)
def write_sudo_rules(self, user, rules, sudo_file=None): def write_sudo_rules(self,
if not sudo_file: user,
sudo_file = "/etc/sudoers.d/90-cloud-init-users" rules,
sudo_file="/etc/sudoers.d/90-cloud-init-users",
):
content_header = "# user rules for %s" % user content_header = "# user rules for %s" % user
content = "%s\n%s %s\n\n" % (content_header, user, rules) content = "%s\n%s %s\n\n" % (content_header, user, rules)

View File

@ -47,7 +47,7 @@ META_DATA_NOT_SUPPORTED = {
'instance-id': 455, 'instance-id': 455,
'local-hostname': 'localhost', 'local-hostname': 'localhost',
'placement': {}, 'placement': {},
} }
def read_user_data_callback(mount_dir): def read_user_data_callback(mount_dir):

View File

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

View File

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

View File

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