diff options
Diffstat (limited to 'cloudinit')
| -rw-r--r-- | cloudinit/config/cc_power_state_change.py | 2 | ||||
| -rw-r--r-- | cloudinit/distros/__init__.py | 6 | ||||
| -rw-r--r-- | cloudinit/distros/debian.py | 5 | ||||
| -rw-r--r-- | cloudinit/distros/rhel.py | 5 | ||||
| -rw-r--r-- | cloudinit/ssh_util.py | 10 | ||||
| -rw-r--r-- | cloudinit/util.py | 2 | 
6 files changed, 17 insertions, 13 deletions
diff --git a/cloudinit/config/cc_power_state_change.py b/cloudinit/config/cc_power_state_change.py index aefa3aff..de0c0bbd 100644 --- a/cloudinit/config/cc_power_state_change.py +++ b/cloudinit/config/cc_power_state_change.py @@ -75,7 +75,7 @@ def load_power_state(cfg):                          ','.join(opt_map.keys()))      delay = pstate.get("delay", "now") -    if delay != "now" and not re.match("\+[0-9]+", delay): +    if delay != "now" and not re.match(r"\+[0-9]+", delay):          raise TypeError("power_state[delay] must be 'now' or '+m' (minutes).")      args = ["shutdown", opt_map[mode], delay] diff --git a/cloudinit/distros/__init__.py b/cloudinit/distros/__init__.py index 0db4aac7..2a2d8216 100644 --- a/cloudinit/distros/__init__.py +++ b/cloudinit/distros/__init__.py @@ -73,7 +73,7 @@ class Distro(object):          self._apply_hostname(hostname)      @abc.abstractmethod -    def package_command(self, cmd, args=None): +    def package_command(self, cmd, args=None, pkgs=None):          raise NotImplementedError()      @abc.abstractmethod @@ -370,7 +370,7 @@ class Distro(object):          # Import SSH keys          if 'ssh_authorized_keys' in kwargs:              keys = set(kwargs['ssh_authorized_keys']) or [] -            ssh_util.setup_user_keys(keys, name, key_prefix=None) +            ssh_util.setup_user_keys(keys, name, options=None)          return True @@ -776,7 +776,7 @@ def normalize_users_groups(cfg, distro):              # Just add it on at the end...              base_users.append({'name': 'default'})          elif isinstance(base_users, (dict)): -            base_users['default'] = base_users.get('default', True) +            base_users['default'] = dict(base_users).get('default', True)          elif isinstance(base_users, (str, basestring)):              # Just append it on to be re-parsed later              base_users += ",default" diff --git a/cloudinit/distros/debian.py b/cloudinit/distros/debian.py index 1a8e927b..1f2848d2 100644 --- a/cloudinit/distros/debian.py +++ b/cloudinit/distros/debian.py @@ -142,7 +142,10 @@ class Distro(distros.Distro):          # This ensures that the correct tz will be used for the system          util.copy(tz_file, self.tz_local_fn) -    def package_command(self, command, args=None, pkgs=[]): +    def package_command(self, command, args=None, pkgs=None): +        if pkgs is None: +            pkgs = [] +          e = os.environ.copy()          # See: http://tiny.cc/kg91fw          # Or: http://tiny.cc/mh91fw diff --git a/cloudinit/distros/rhel.py b/cloudinit/distros/rhel.py index 2f91e386..9fee5fd1 100644 --- a/cloudinit/distros/rhel.py +++ b/cloudinit/distros/rhel.py @@ -208,7 +208,10 @@ class Distro(distros.Distro):          # This ensures that the correct tz will be used for the system          util.copy(tz_file, self.tz_local_fn) -    def package_command(self, command, args=None, pkgs=[]): +    def package_command(self, command, args=None, pkgs=None): +        if pkgs is None: +            pkgs = [] +          cmd = ['yum']          # If enabled, then yum will be tolerant of errors on the command line          # with regard to packages. diff --git a/cloudinit/ssh_util.py b/cloudinit/ssh_util.py index 65fab117..95133236 100644 --- a/cloudinit/ssh_util.py +++ b/cloudinit/ssh_util.py @@ -19,9 +19,6 @@  #    You should have received a copy of the GNU General Public License  #    along with this program.  If not, see <http://www.gnu.org/licenses/>. -from StringIO import StringIO - -import csv  import os  import pwd @@ -42,6 +39,7 @@ VALID_KEY_TYPES = ("rsa", "dsa", "ssh-rsa", "ssh-dss", "ecdsa",      "ecdsa-sha2-nistp384-cert-v01@openssh.com",      "ecdsa-sha2-nistp521-cert-v01@openssh.com") +  class AuthKeyLine(object):      def __init__(self, source, keytype=None, base64=None,                   comment=None, options=None): @@ -141,14 +139,14 @@ class AuthKeyLineParser(object):          ent = line.strip()          try:              (keytype, base64, comment) = parse_ssh_key(ent) -        except TypeError as e: +        except TypeError:              (keyopts, remain) = self._extract_options(ent)              if options is None:                  options = keyopts -             +              try:                  (keytype, base64, comment) = parse_ssh_key(remain) -            except TypeError as e: +            except TypeError:                  return AuthKeyLine(src_line)          return AuthKeyLine(src_line, keytype=keytype, base64=base64, diff --git a/cloudinit/util.py b/cloudinit/util.py index d0a6f81c..afde2066 100644 --- a/cloudinit/util.py +++ b/cloudinit/util.py @@ -1530,7 +1530,7 @@ def get_proc_env(pid):      fn = os.path.join("/proc/", str(pid), "environ")      try:          contents = load_file(fn) -        toks = contents.split("\0") +        toks = contents.split("\x00")          for tok in toks:              if tok == "":                  continue  | 
