summaryrefslogtreecommitdiff
path: root/cloudinit/distros
diff options
context:
space:
mode:
authorScott Moser <smoser@brickies.net>2017-04-27 12:50:12 -0400
committerScott Moser <smoser@brickies.net>2017-04-27 12:50:12 -0400
commit8310484a880690529a4936615df596d467e51708 (patch)
tree886aeb1a6e3ca809e466ddbcacbe9741b56dafa0 /cloudinit/distros
parentaf63cf763946bca6163dc797195a3aeae975f8da (diff)
parent513e99e049eab4acea14e187f59d760adc755b40 (diff)
downloadvyos-cloud-init-8310484a880690529a4936615df596d467e51708.tar.gz
vyos-cloud-init-8310484a880690529a4936615df596d467e51708.zip
merge from 513e99e049ea at 0.7.9-113-g513e99e0
Diffstat (limited to 'cloudinit/distros')
-rwxr-xr-xcloudinit/distros/__init__.py31
-rw-r--r--cloudinit/distros/arch.py6
-rw-r--r--cloudinit/distros/debian.py5
-rw-r--r--cloudinit/distros/freebsd.py8
-rw-r--r--cloudinit/distros/gentoo.py11
-rw-r--r--cloudinit/distros/parsers/hosts.py4
-rw-r--r--cloudinit/distros/parsers/resolv_conf.py6
-rw-r--r--cloudinit/distros/rhel.py4
-rwxr-xr-xcloudinit/distros/ug_util.py16
9 files changed, 47 insertions, 44 deletions
diff --git a/cloudinit/distros/__init__.py b/cloudinit/distros/__init__.py
index 803ac74e..28650b88 100755
--- a/cloudinit/distros/__init__.py
+++ b/cloudinit/distros/__init__.py
@@ -143,9 +143,9 @@ class Distro(object):
def _apply_network_from_network_config(self, netconfig, bring_up=True):
distro = self.__class__
- LOG.warn("apply_network_config is not currently implemented "
- "for distribution '%s'. Attempting to use apply_network",
- distro)
+ LOG.warning("apply_network_config is not currently implemented "
+ "for distribution '%s'. Attempting to use apply_network",
+ distro)
header = '\n'.join([
"# Converted from network_config for distro %s" % distro,
"# Implmentation of _write_network_config is needed."
@@ -335,7 +335,8 @@ class Distro(object):
try:
(_out, err) = util.subp(cmd)
if len(err):
- LOG.warn("Running %s resulted in stderr output: %s", cmd, err)
+ LOG.warning("Running %s resulted in stderr output: %s",
+ cmd, err)
return True
except util.ProcessExecutionError:
util.logexc(LOG, "Running interface command %s failed", cmd)
@@ -358,7 +359,7 @@ class Distro(object):
Add a user to the system using standard GNU tools
"""
if util.is_user(name):
- LOG.info("User %s already exists, skipping." % name)
+ LOG.info("User %s already exists, skipping.", name)
return
if 'create_groups' in kwargs:
@@ -520,9 +521,9 @@ class Distro(object):
keys = list(keys.values())
if keys is not None:
if not isinstance(keys, (tuple, list, set)):
- LOG.warn("Invalid type '%s' detected for"
- " 'ssh_authorized_keys', expected list,"
- " string, dict, or set.", type(keys))
+ LOG.warning("Invalid type '%s' detected for"
+ " 'ssh_authorized_keys', expected list,"
+ " string, dict, or set.", type(keys))
else:
keys = set(keys) or []
ssh_util.setup_user_keys(keys, name, options=None)
@@ -595,7 +596,7 @@ class Distro(object):
"#includedir %s" % (path), '']
sudoers_contents = "\n".join(lines)
util.append_file(sudo_base, sudoers_contents)
- LOG.debug("Added '#includedir %s' to %s" % (path, sudo_base))
+ LOG.debug("Added '#includedir %s' to %s", path, sudo_base)
except IOError as e:
util.logexc(LOG, "Failed to write %s", sudo_base)
raise e
@@ -647,11 +648,11 @@ class Distro(object):
# Check if group exists, and then add it doesn't
if util.is_group(name):
- LOG.warn("Skipping creation of existing group '%s'" % name)
+ LOG.warning("Skipping creation of existing group '%s'", name)
else:
try:
util.subp(group_add_cmd)
- LOG.info("Created new group %s" % name)
+ LOG.info("Created new group %s", name)
except Exception:
util.logexc(LOG, "Failed to create group %s", name)
@@ -659,12 +660,12 @@ class Distro(object):
if len(members) > 0:
for member in members:
if not util.is_user(member):
- LOG.warn("Unable to add group member '%s' to group '%s'"
- "; user does not exist.", member, name)
+ LOG.warning("Unable to add group member '%s' to group '%s'"
+ "; user does not exist.", member, name)
continue
util.subp(['usermod', '-a', '-G', name, member])
- LOG.info("Added user '%s' to group '%s'" % (member, name))
+ LOG.info("Added user '%s' to group '%s'", member, name)
def _get_package_mirror_info(mirror_info, data_source=None,
@@ -708,7 +709,7 @@ def _get_package_mirror_info(mirror_info, data_source=None,
if found:
results[name] = found
- LOG.debug("filtered distro mirror info: %s" % results)
+ LOG.debug("filtered distro mirror info: %s", results)
return results
diff --git a/cloudinit/distros/arch.py b/cloudinit/distros/arch.py
index 64b8c1fb..75d46201 100644
--- a/cloudinit/distros/arch.py
+++ b/cloudinit/distros/arch.py
@@ -83,7 +83,8 @@ class Distro(distros.Distro):
try:
(_out, err) = util.subp(cmd)
if len(err):
- LOG.warn("Running %s resulted in stderr output: %s", cmd, err)
+ LOG.warning("Running %s resulted in stderr output: %s",
+ cmd, err)
except util.ProcessExecutionError:
util.logexc(LOG, "Running interface command %s failed", cmd)
@@ -94,7 +95,8 @@ class Distro(distros.Distro):
try:
(_out, err) = util.subp(cmd)
if len(err):
- LOG.warn("Running %s resulted in stderr output: %s", cmd, err)
+ LOG.warning("Running %s resulted in stderr output: %s",
+ cmd, err)
return True
except util.ProcessExecutionError:
util.logexc(LOG, "Running interface command %s failed", cmd)
diff --git a/cloudinit/distros/debian.py b/cloudinit/distros/debian.py
index 3f0f9d53..d06d46a6 100644
--- a/cloudinit/distros/debian.py
+++ b/cloudinit/distros/debian.py
@@ -143,8 +143,7 @@ class Distro(distros.Distro):
pkgs = []
e = os.environ.copy()
- # See: http://tiny.cc/kg91fw
- # Or: http://tiny.cc/mh91fw
+ # See: http://manpages.ubuntu.com/manpages/xenial/man7/debconf.7.html
e['DEBIAN_FRONTEND'] = 'noninteractive'
wcfg = self.get_option("apt_get_wrapper", APT_GET_WRAPPER)
@@ -224,6 +223,6 @@ def _maybe_remove_legacy_eth0(path="/etc/network/interfaces.d/eth0.cfg"):
except Exception:
msg = bmsg + " %s exists, but could not be read." % path
- LOG.warn(msg)
+ LOG.warning(msg)
# vi: ts=4 expandtab
diff --git a/cloudinit/distros/freebsd.py b/cloudinit/distros/freebsd.py
index a70ee45b..183e4452 100644
--- a/cloudinit/distros/freebsd.py
+++ b/cloudinit/distros/freebsd.py
@@ -148,7 +148,7 @@ class Distro(distros.Distro):
def create_group(self, name, members):
group_add_cmd = ['pw', '-n', name]
if util.is_group(name):
- LOG.warn("Skipping creation of existing group '%s'", name)
+ LOG.warning("Skipping creation of existing group '%s'", name)
else:
try:
util.subp(group_add_cmd)
@@ -160,8 +160,8 @@ class Distro(distros.Distro):
if len(members) > 0:
for member in members:
if not util.is_user(member):
- LOG.warn("Unable to add group member '%s' to group '%s'"
- "; user does not exist.", member, name)
+ LOG.warning("Unable to add group member '%s' to group '%s'"
+ "; user does not exist.", member, name)
continue
try:
util.subp(['pw', 'usermod', '-n', name, '-G', member])
@@ -369,7 +369,7 @@ class Distro(distros.Distro):
# OS. This is just fine.
(_out, err) = util.subp(cmd, rcs=[0, 1])
if len(err):
- LOG.warn("Error running %s: %s", cmd, err)
+ LOG.warning("Error running %s: %s", cmd, err)
def install_packages(self, pkglist):
self.update_package_sources()
diff --git a/cloudinit/distros/gentoo.py b/cloudinit/distros/gentoo.py
index 83fb56ff..0ad2f032 100644
--- a/cloudinit/distros/gentoo.py
+++ b/cloudinit/distros/gentoo.py
@@ -96,8 +96,8 @@ class Distro(distros.Distro):
try:
(_out, err) = util.subp(cmd)
if len(err):
- LOG.warn("Running %s resulted in stderr output: %s",
- cmd, err)
+ LOG.warning("Running %s resulted in stderr output: %s",
+ cmd, err)
except util.ProcessExecutionError:
util.logexc(LOG, "Running interface command %s failed",
cmd)
@@ -121,7 +121,8 @@ class Distro(distros.Distro):
try:
(_out, err) = util.subp(cmd)
if len(err):
- LOG.warn("Running %s resulted in stderr output: %s", cmd, err)
+ LOG.warning("Running %s resulted in stderr output: %s",
+ cmd, err)
return True
except util.ProcessExecutionError:
util.logexc(LOG, "Running interface command %s failed", cmd)
@@ -138,8 +139,8 @@ class Distro(distros.Distro):
try:
(_out, err) = util.subp(cmd)
if len(err):
- LOG.warn("Running %s resulted in stderr output: %s", cmd,
- err)
+ LOG.warning("Running %s resulted in stderr output: %s",
+ cmd, err)
except util.ProcessExecutionError:
util.logexc(LOG, "Running interface command %s failed", cmd)
return False
diff --git a/cloudinit/distros/parsers/hosts.py b/cloudinit/distros/parsers/hosts.py
index 87f164be..64444581 100644
--- a/cloudinit/distros/parsers/hosts.py
+++ b/cloudinit/distros/parsers/hosts.py
@@ -10,8 +10,8 @@ from cloudinit.distros.parsers import chop_comment
# See: man hosts
-# or http://unixhelp.ed.ac.uk/CGI/man-cgi?hosts
-# or http://tinyurl.com/6lmox3
+# or https://linux.die.net/man/5/hosts
+# or https://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/configtuning-configfiles.html # noqa
class HostsConf(object):
def __init__(self, text):
self._text = text
diff --git a/cloudinit/distros/parsers/resolv_conf.py b/cloudinit/distros/parsers/resolv_conf.py
index d1f8a042..a62055ae 100644
--- a/cloudinit/distros/parsers/resolv_conf.py
+++ b/cloudinit/distros/parsers/resolv_conf.py
@@ -81,9 +81,9 @@ class ResolvConf(object):
if len(new_ns) == len(current_ns):
return current_ns
if len(current_ns) >= 3:
- LOG.warn("ignoring nameserver %r: adding would "
- "exceed the maximum of "
- "'3' name servers (see resolv.conf(5))" % (ns))
+ LOG.warning("ignoring nameserver %r: adding would "
+ "exceed the maximum of "
+ "'3' name servers (see resolv.conf(5))", ns)
return current_ns[:3]
self._remove_option('nameserver')
for n in new_ns:
diff --git a/cloudinit/distros/rhel.py b/cloudinit/distros/rhel.py
index 372c7d0f..1fecb619 100644
--- a/cloudinit/distros/rhel.py
+++ b/cloudinit/distros/rhel.py
@@ -28,7 +28,7 @@ def _make_sysconfig_bool(val):
class Distro(distros.Distro):
- # See: http://tiny.cc/6r99fw
+ # See: https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/7/html/Networking_Guide/sec-Network_Configuration_Using_sysconfig_Files.html # noqa
clock_conf_fn = "/etc/sysconfig/clock"
locale_conf_fn = '/etc/sysconfig/i18n'
systemd_locale_conf_fn = '/etc/locale.conf'
@@ -130,8 +130,8 @@ class Distro(distros.Distro):
rhel_util.update_sysconfig_file(out_fn, host_cfg)
def _select_hostname(self, hostname, fqdn):
- # See: http://bit.ly/TwitgL
# Should be fqdn if we can use it
+ # See: https://www.centos.org/docs/5/html/Deployment_Guide-en-US/ch-sysconfig.html#s2-sysconfig-network # noqa
if fqdn:
return fqdn
return hostname
diff --git a/cloudinit/distros/ug_util.py b/cloudinit/distros/ug_util.py
index 53a0eafb..9378dd78 100755
--- a/cloudinit/distros/ug_util.py
+++ b/cloudinit/distros/ug_util.py
@@ -214,8 +214,8 @@ def normalize_users_groups(cfg, distro):
'name': old_user,
}
if not isinstance(old_user, dict):
- LOG.warn(("Format for 'user' key must be a string or "
- "dictionary and not %s"), type_utils.obj_name(old_user))
+ LOG.warning(("Format for 'user' key must be a string or dictionary"
+ " and not %s"), type_utils.obj_name(old_user))
old_user = {}
# If no old user format, then assume the distro
@@ -227,9 +227,9 @@ def normalize_users_groups(cfg, distro):
try:
distro_user_config = distro.get_default_user()
except NotImplementedError:
- LOG.warn(("Distro has not implemented default user "
- "access. No distribution provided default user"
- " will be normalized."))
+ LOG.warning(("Distro has not implemented default user "
+ "access. No distribution provided default user"
+ " will be normalized."))
# Merge the old user (which may just be an empty dict when not
# present with the distro provided default user configuration so
@@ -239,9 +239,9 @@ def normalize_users_groups(cfg, distro):
base_users = cfg.get('users', [])
if not isinstance(base_users, (list, dict) + six.string_types):
- LOG.warn(("Format for 'users' key must be a comma separated string"
- " or a dictionary or a list and not %s"),
- type_utils.obj_name(base_users))
+ LOG.warning(("Format for 'users' key must be a comma separated string"
+ " or a dictionary or a list and not %s"),
+ type_utils.obj_name(base_users))
base_users = []
if old_user: