1. 17 Sep, 2018 1 commit
  2. 23 Dec, 2016 3 commits
  3. 22 Dec, 2016 2 commits
    • Wesley Wiedenmeier's avatar
      integration test: initial commit of integration test framework · f53fc46a
      Wesley Wiedenmeier authored
      The adds in end-to-end testing of cloud-init. The framework utilizes
      LXD and cloud images as a backend to test user-data passed in.
      Arbitrary data is then captured from predefined commands specified
      by the user. After collection, data verification is completed by
      running a series of Python unit tests against the collected data.
      
      Currently only the Ubuntu Trusty, Xenial, Yakkety, and Zesty
      releases are supported. Test cases for 50% of the modules is
      complete and available.
      
      Additionally a Read the Docs file was created to guide test
      writing and execution.
      f53fc46a
    • Jon Grimm's avatar
      LICENSE: Allow dual licensing GPL-3 or Apache 2.0 · b2a9f336
      Jon Grimm authored
      This has been a recurring ask and we had initially just made the change to
      the cloud-init 2.0 codebase.  As the current thinking is we'll just
      continue to enhance the current codebase, its desirable to relicense to
      match what we'd intended as part of the 2.0 plan here.
      
      - put a brief description of license in LICENSE file
      - put full license versions in LICENSE-GPLv3 and LICENSE-Apache2.0
      - simplify the per-file header to reference LICENSE
      - tox: ignore H102 (Apache License Header check)
      
      Add license header to files that ship.
      Reformat headers, make sure everything has vi: at end of file.
      
      Non-shipping files do not need the copyright header,
      but at the moment tests/ have it.
      b2a9f336
  4. 21 Dec, 2016 1 commit
  5. 20 Dec, 2016 2 commits
    • Scott Moser's avatar
      pep8: whitespace fix · 93cf879d
      Scott Moser authored
      93cf879d
    • Michael Felt's avatar
      Update the list of valid ssh keys. · 77092338
      Michael Felt authored
      Update ssh_util.py with latest list of keys (from openssh-7.3p1/sshkeys.c),
      and remove extinct keys ending with "-v00@openssh.com"
      
      Added keys:
        rsa-sha2-256,
        rsa-sha2-512,
        ed25519,
        ssh-ed25519,
        ssh-ed25519-cert-v01@openssh.com
      
      Removed both of the double entries for the keys:
        ssh-dss-cert-v00@openssh.com
        ssh-rsa-cert-v00@openssh.com
      77092338
  6. 19 Dec, 2016 5 commits
    • Scott Moser's avatar
      network: add ENI unit test for statically rendered routes. · 07156319
      Scott Moser authored
      This just adds a unit test for a case found to be failing in curtin.
      The issue was reported under bug 1649652.
      07156319
    • Lars Kellogg-Stedman's avatar
      set_hostname: avoid erroneously appending domain to fqdn · c0112949
      Lars Kellogg-Stedman authored
      In some situations, cloud-init will erroneously append a default
      domain to an already fully qualified hostname, resulting in something
      like 'localhost.localdomain.localdomain'.  This patch checks to see if
      the value returned by util.get_hostname() contains a '.', and if it
      does treats it as a fully qualified name.
      
      Resolves: rhbz#1389048
      LP: #1647910
      c0112949
    • Anhad Jai Singh's avatar
      doc: change 'nobootwait' to 'nofail' in docs · 39fb5a02
      Anhad Jai Singh authored
      'nobootwait' is an upstart specific extension to the mount syntax that is
      not supported by other mount systems.  As Ubuntu 16.04 moved from upstart
      to systemd, support for 'nobootwait' was lost.
      
      All examples using 'nobootwait' are updated to use the standard 'nofail',
      which gives the expected behaviour of not failing to boot in case a volume
      is missing. There are subtle differences in semantics between
      'nobootwait' and 'nofail', but it is the best substitute that gives
      behaviour similar to the upstart specific option.
      39fb5a02
    • Joshua Harlow's avatar
      Replace an expired bit.ly link in code comment. · 1b6d1624
      Joshua Harlow authored
      The bit.ly link seems to have expired.  Replace it with link to
      'latest' version of EC2 docs.
      1b6d1624
    • Scott Moser's avatar
      user-groups: fix bug when groups was provided as string and had spaces · ca3ae672
      Scott Moser authored
      Cloud-config provided like:
        users:
          - default
          - name: foobar
            groups: sudo, adm
      
      Would result in adduser being called as:
        useradd foobar --groups 'sudo, adm' -m
      Which would cause error:
        useradd: group ' adm' does not exist
      
      The fix here is just to always normalize groups and remove whitespace.
      
      Additionally a fix and unit tests to explicitly set system=False
      or no_create_home=True.  Previously those paths did not test the value
      of the entry, only the presense of the entry.
      
      LP: #1354694
      ca3ae672
  7. 12 Dec, 2016 2 commits
    • Scott Moser's avatar
      mounts: use mount -a again to accomplish mounts · c9c9197a
      Scott Moser authored
      During recent changes to cc_mounts, on systemd systems, we started using
        systemctl daemon-reload
      rather than 'mount -a' to get mounts done.
      
      The belief was that since entries in /etc/fstab would be written
      to tell systemd that they should be after cloud-init
      (x-systemd.requires=cloud-init.service) that the reload would then
      let systemd mount the units as expected.
      
      That doesn't seem to work, and new mount entries end up not getting
      mounted.  The change here moves back to using 'mount -a', but
      then also does a systemctl daemon-reload.
      
      LP: #1647708
      c9c9197a
    • Scott Moser's avatar
      CloudSigma: Fix bug where datasource was not loaded in local search. · a9d41de4
      Scott Moser authored
      CloudSigma would not get any datasources loaded during cloud-init local.
      Thus, when the network datasource was removed, *no* CloudSigma
      datasources would be loaded.
      
      LP: #1648380
      a9d41de4
  8. 04 Dec, 2016 1 commit
    • Lars Kellogg-Stedman's avatar
      when adding a user, strip whitespace from group list · cbf93eb4
      Lars Kellogg-Stedman authored
      The documentation shows group names in the 'groups:' key delimited by
      ", ", but this will result in group names that contain spaces.  This
      can cause the 'groupadd' or 'useradd' commands to fail.
      
      This patch ensures that we strip whitespace from either end of the
      group names passed to the 'groups:' key.
      
      LP: #1354694
      cbf93eb4
  9. 03 Dec, 2016 1 commit
    • Scott Moser's avatar
      fix decoding of utf-8 chars in yaml test · 166df605
      Scott Moser authored
      Python 3 would fail to load yaml from doc/examples/cloud-config-apt.txt
      when the LANG (specifically LC_CTYPE) was 'C'.
      
      The changes here do 2 things:
       a.) remove the non-ascii characters from the yaml file.
       b.) fix the validate-yaml.py program to decode using utf-8 specifically
           rather than using the inherited settings.
      
      This fixes it now for ascii and in the future also should non-ascii slip in.
      166df605
  10. 02 Dec, 2016 2 commits
  11. 28 Nov, 2016 1 commit
  12. 23 Nov, 2016 1 commit
  13. 22 Nov, 2016 10 commits
    • Scott Moser's avatar
      net/cmdline: Consider ip= or ip6= on command line not only ip= · 6e92c5f2
      Scott Moser authored
      The previous behavior would miss ip6= on the command line and
      would not pay attention to the written net-* or net6-* files if
      only ip6= was found.
      
      The fix here enables parsing the files if either ip= or ip6= is found,
      and adds some tests as well.
      
      LP: #1639930
      6e92c5f2
    • Joshua Harlow's avatar
      Just use file logging by default · 11b1aba4
      Joshua Harlow authored
      Instead of being dependent on the availability of syslog that
      various distributions may not enable or configure correctly
      or they do so via patches just use a known-to-work default
      logging mechanism.  If distros want to change this, that
      is fine, but at least the built-in one will work reliably.
      
      LP: #1643990
      11b1aba4
    • Wesley Wiedenmeier's avatar
      Improve formatting for ProcessExecutionError · 0fd1dd02
      Wesley Wiedenmeier authored
      This replaces long single lines in a log or console output
      with multiple lines that are much easier to read.
      It indents the stdout and stderr so logs are more easily
      read also.
      0fd1dd02
    • Scott Moser's avatar
      flake8: fix trailing white space · bc4d9c59
      Scott Moser authored
      bc4d9c59
    • Sean Bright's avatar
      Doc: various documentation fixes · 7e586f0d
      Sean Bright authored
      Several various minor fixes for the readthedocs documentation.
      7e586f0d
    • Brent Baude's avatar
      cloudinit/config/cc_rh_subscription.py: Remove repos before adding · edd94ebf
      Brent Baude authored
      A user has pointed out that upon set up of a machine, users typically
      remove repos (sometimes all of them) and then add repos in. This does
      make sense for a typical user.
      edd94ebf
    • Scott Moser's avatar
      packages/redhat: fix rpm spec file. · de07968c
      Scott Moser authored
      Adjust the redhat spec file to fix errors found during a ./tools/brpm
      on centos 6:
        RPM build errors:
          File listed twice: /usr/libexec/cloud-init/uncloud-init
          File listed twice: /usr/libexec/cloud-init/write-ssh-key-fingerprints
          Installed (but unpackaged) file(s) found:
           /etc/NetworkManager/dispatcher.d/hook-network-manager
           /etc/dhcp/dhclient-exit-hooks.d/hook-dhclient
      de07968c
    • Ryan Harper's avatar
      main: set TZ in environment if not already set. · 4f0a2774
      Ryan Harper authored
      If TZ is not set in environment, then datetime.datetime() will
      stat /etc/localtime on every usage.  datetime is used in the logging
      path of cloud-init, and as such this is very busy.
      During a normal cloud-init boot, it results in we roughly
      400+ stat calls to /etc/localtime.
      
      The value we set is :/etc/localtime, which is described at
        https://www.gnu.org/software/libc/manual/html_node/TZ-Variable.html
      
      See also merge proposal at 307722 for more background.
      https://code.launchpad.net/~raharper/cloud-init/+git/cloud-init/+merge/307722
      4f0a2774
    • Scott Moser's avatar
      Azure: No longer rely on walinux agent. · 677b85ab
      Scott Moser authored
      Cloud-init has for some time relied on walinuxagent to do some bits
      of work necessary for instance initialization.  That reliance has
      not been needed for a while, but we have still defaulted to it.
      
      This change uses the "builtin" path that Daniel Watkins added
      some time ago by default.  Also, Adjust tests that assumed the
      non-__builtin__ Azure agent_command.
      
      LP: #1538522
      677b85ab
    • Daniel Watkins's avatar
      disk_setup: Use sectors as unit when formatting MBR disks with sfdisk. · 18203bf1
      Daniel Watkins authored
      The version of sfdisk in wily (and onwards) only accepts sectors as a
      valid disk size. As such, this refactors the MBR code path in
      cc_disk_setup to use sectors.
      
       - use --unit=S: while newer versions of sfdisk assume --unit=S, older
         versions do not so we specifically pass it in.  Versions of sfdisk
         found in supported OSes such as centos6 wont assume --unit=S.
       - add --force: this exists back to centos 6 (2.17.2), so it should
         be fine, and is what we ultimately want.
         "do what I say, even if it is stupid"
       - keep --Linux.  Even though this has been deprecated for quite some
         time, we keep it until versions that want it are unsupported.
         If necessary at some point we could check for util linux version
         and if it had --Linux and use it in those cases.
      
      Additionally, improve usefulness of some log messages.
      
      LP: #1460715
      18203bf1
  14. 18 Nov, 2016 1 commit
    • Scott Moser's avatar
      Add activate_datasource, for datasource specific code paths. · 9e904bbc
      Scott Moser authored
      This adds a call to 'activate_datasource'.  That will be called
      during init stage (or init-local in the event of a 'local' dsmode).
      It is present so that the datasource can do platform specific operations
      that may be necessary.  It is passed the fully rendered cloud-config
      and whether or not the instance is a new instance.
      
      The Azure datasource uses this to address formatting of the ephemeral
      devices.  It does so by
       a.) waiting for the device to come online
       b.) removing the marker files for the disk_setup and mounts modules
           if it finds that the ephemeral device has been reset.
      
      LP: #1611074
      9e904bbc
  15. 15 Nov, 2016 3 commits
    • Scott Moser's avatar
      systemd: cloud-init-local use RequiresMountsFor=/var/lib/cloud · 9d826b88
      Scott Moser authored
      While cloud-init writes its data to /var/lib/cloud, we
      previously lazily added RequiresMountsFor=/var/lib .  It is more correct
      to list the more complete path.
      
      LP: #1642062
      9d826b88
    • Scott Moser's avatar
      systemd: cloud-init remove After=systemd-networkd-wait-online · b6561a13
      Scott Moser authored
      cloud-init.service cannot currently run
        After=systemd-networkd-wait-online.service
      as systemd-networkd.service is After dbus.service, but
      cloud-init.service is:
        Before=sysinit.target
      and sysinit.target is before dbus.service.
      
      The result is that we are temporarily preferring for cases
      where there is systemd-networkd in place to have cloud-init.service run
      without networking properly configured.
      
      See bug 1636912 for more information.
      b6561a13
    • Scott Moser's avatar
      systemd: cloud-init-local change Before basic to sysinit · d0e293e4
      Scott Moser authored
      sysinit.target happens earlier in boot than basic.target.
      cloud-init-local.service had:
        Before=basic.target
      but cloud-init.service had:
        After=cloud-init-local.service
        Before=sysinit.target
      
      The result was that cloud-init-local.service was indirectly
      Before sysinit.target anyway, so this change is just to more
      specifically state that.
      d0e293e4
  16. 11 Nov, 2016 1 commit
  17. 10 Nov, 2016 3 commits
    • Scott Moser's avatar
      systemd: drop both Wants and After local-fs.target · bf4010a9
      Scott Moser authored
      Drop mention of local-fs.target from both cloud-init-local.service
      and cloud-init.service.  This could actually could cause a loop in
      ordering due to cc_mounts writing mount points with:
        x-systemd.requires=cloud-init.service
      
      Rather, we specifically list /var/lib/ and systemd-remount-fs.service
      in cloud-init-local.service.   cloud-init.service will run after
      cloud-init-local and thus will have these satisfied.
      bf4010a9
    • Scott Moser's avatar
      systemd: networking service adjustments. · f7d6bfad
      Scott Moser authored
      Here we drop the Requires=networking.service but keep the
      After=networking.service.  The change there is that we no longer
      force networking.service to run, as the system may not have it or
      be configured to use it.
      
      Second, we add After=systemd-networkd-wait-online.service.
      That causes us to run after systemd-networkd has brought networking
      up.
      
      The end result is that we now run after both ifupdown or
      systemd-networkd (if they were going to run) but do not force either
      to run.
      
      One other change is that by dropping Requires=networking.service
      cloud-init will now run even if networking failed to come up.
      
      LP: #1636912
      f7d6bfad
    • Scott Moser's avatar
      systemd: replace Before=basic.target, dbus.target with sysinit.target · e568aec3
      Scott Moser authored
      Per discussion on bug 1636912 and subsequent feedback on bug 1629797,
      using:
        Before=sysinit.target
      is a simpler solution than what we had implemented:
        Before=basic.target
        Before=dbus.target
      
      LP: #1629797
      e568aec3