← Back to team overview

cloud-init-dev team mailing list archive

Re: [Merge] ~chad.smith/cloud-init:uninitialized-variables into cloud-init:master

 


Diff comments:

> diff --git a/cloudinit/cmd/status.py b/cloudinit/cmd/status.py
> index 3e5d0d0..d7aaee9 100644
> --- a/cloudinit/cmd/status.py
> +++ b/cloudinit/cmd/status.py
> @@ -93,6 +93,8 @@ def _is_cloudinit_disabled(disable_file, paths):
>      elif not os.path.exists(os.path.join(paths.run_dir, 'enabled')):
>          is_disabled = True
>          reason = 'Cloud-init disabled by cloud-init-generator'
> +    else:
> +        reason = 'Cloud-init enabled by systemd cloud-init-generator'

Only because I differentiated between systemd enabled versus sysvinit a couple lines above. Maybe we just drop the implementation details from both. We don't actually surface this information to users anyway when cloud-init is enabled, so these two enable 'reasons' are ignored by status code.

>      return (is_disabled, reason)
>  
>  
> diff --git a/cloudinit/cmd/tests/test_status.py b/cloudinit/cmd/tests/test_status.py
> index 6d4a11e..bc28c09 100644
> --- a/cloudinit/cmd/tests/test_status.py
> +++ b/cloudinit/cmd/tests/test_status.py
> @@ -137,8 +150,9 @@ class TestStatus(CiTestCase):
>          self.assertEqual(expected, m_stdout.getvalue())
>  
>      def test_status_returns_running(self):
> -        '''Report running when status file exists but isn't finished.'''
> -        write_json(self.status_file, {'v1': {'init': {'finished': None}}})
> +        '''Report running when status  exists with an unfinished stage.'''

fixed.

> +        write_json(self.status_file,
> +                   {'v1': {'init': {'start': 1, 'finished': None}}})
>          cmdargs = myargs(long=False, wait=False)
>          with mock.patch('sys.stdout', new_callable=StringIO) as m_stdout:
>              retcode = wrap_and_call(
> diff --git a/cloudinit/config/cc_rh_subscription.py b/cloudinit/config/cc_rh_subscription.py
> index a9d21e7..b4ae5e1 100644
> --- a/cloudinit/config/cc_rh_subscription.py
> +++ b/cloudinit/config/cc_rh_subscription.py
> @@ -276,9 +276,8 @@ class SubscriptionManager(object):
>          cmd = ['attach', '--auto']
>          try:
>              return_out, return_err = self._sub_man_cli(cmd)
> -        except util.ProcessExecutionError:
> -            self.log_warn("Auto-attach failed with: "
> -                          "{0}]".format(return_err.strip()))
> +        except util.ProcessExecutionError as e:
> +            self.log_warn("Auto-attach failed with: {0}]".format(e))

fixed.

>              return False
>          for line in return_out.split("\n"):
>              if line is not "":
> diff --git a/cloudinit/distros/freebsd.py b/cloudinit/distros/freebsd.py
> index bad112f..823b52a 100644
> --- a/cloudinit/distros/freebsd.py
> +++ b/cloudinit/distros/freebsd.py
> @@ -347,15 +348,10 @@ class Distro(distros.Distro):
>              bymac[Distro.get_interface_mac(n)] = {
>                  'name': n, 'up': self.is_up(n), 'downable': None}
>  
> +        nics_with_addresses = set()
>          if check_downable:
> -            nics_with_addresses = set()
> -            ipv6 = self.get_ipv6()
> -            ipv4 = self.get_ipv4()
> -            for bytes_out in (ipv6, ipv4):
> -                for i in ipv6:
> -                    nics_with_addresses.update(i)
> -                for i in ipv4:
> -                    nics_with_addresses.update(i)
> +            for i in self.get_ipv4() + self.get_ipv6():
> +                nics_with_addresses.update(i)

hah, yes. and done.

>  
>          for d in bymac.values():
>              d['downable'] = (d['up'] is False or


-- 
https://code.launchpad.net/~chad.smith/cloud-init/+git/cloud-init/+merge/336453
Your team cloud-init commiters is requested to review the proposed merge of ~chad.smith/cloud-init:uninitialized-variables into cloud-init:master.


References