<feed xmlns='http://www.w3.org/2005/Atom'>
<title>vyos-cloud-init.git/cloudinit/sources/tests/test_init.py, branch rolling</title>
<subtitle> (mirror of https://github.com/vyos/vyos-cloud-init.git)
</subtitle>
<id>https://git.amelek.net/vyos/vyos-cloud-init.git/atom?h=rolling</id>
<link rel='self' href='https://git.amelek.net/vyos/vyos-cloud-init.git/atom?h=rolling'/>
<link rel='alternate' type='text/html' href='https://git.amelek.net/vyos/vyos-cloud-init.git/'/>
<updated>2021-12-03T20:11:46+00:00</updated>
<entry>
<title>Reorganize unit test locations under tests/unittests (#1126)</title>
<updated>2021-12-03T20:11:46+00:00</updated>
<author>
<name>Brett Holman</name>
<email>bholman.devel@gmail.com</email>
</author>
<published>2021-12-03T20:11:46+00:00</published>
<link rel='alternate' type='text/html' href='https://git.amelek.net/vyos/vyos-cloud-init.git/commit/?id=039c40f9b3d88ee8158604bb18ca4bf2fb5d5e51'/>
<id>urn:sha1:039c40f9b3d88ee8158604bb18ca4bf2fb5d5e51</id>
<content type='text'>
This attempts to standardize unit test file location under test/unittests/
such that any source file located at cloudinit/path/to/file.py may have a
corresponding unit test file at test/unittests/path/to/test_file.py.

Noteworthy Comments:
====================
Four different duplicate test files existed:
test_{gpg,util,cc_mounts,cc_resolv_conf}.py
Each of these duplicate file pairs has been merged together. This is a
break in git history for these files.

The test suite appears to have a dependency on test order. Changing test
order causes some tests to fail. This should be rectified, but for now
some tests have been modified in
tests/unittests/config/test_set_passwords.py.

A helper class name starts with "Test" which causes pytest to try
executing it as a test case, which then throws warnings "due to Class
having __init__()".  Silence by changing the name of the class.

# helpers.py is imported in many test files, import paths change
cloudinit/tests/helpers.py -&gt; tests/unittests/helpers.py

# Move directories:
cloudinit/distros/tests -&gt; tests/unittests/distros
cloudinit/cmd/devel/tests -&gt; tests/unittests/cmd/devel
cloudinit/cmd/tests -&gt; tests/unittests/cmd/
cloudinit/sources/helpers/tests -&gt; tests/unittests/sources/helpers
cloudinit/sources/tests -&gt; tests/unittests/sources
cloudinit/net/tests -&gt; tests/unittests/net
cloudinit/config/tests -&gt; tests/unittests/config
cloudinit/analyze/tests/ -&gt; tests/unittests/analyze/

# Standardize tests already in tests/unittests/
test_datasource -&gt; sources
test_distros -&gt; distros
test_vmware -&gt; sources/vmware
test_handler -&gt; config        # this contains cloudconfig module tests
test_runs -&gt; runs</content>
</entry>
<entry>
<title>Add retries to DataSourceGCE.py when connecting to GCE (#1005)</title>
<updated>2021-09-21T04:53:05+00:00</updated>
<author>
<name>vteratipally</name>
<email>67723486+vteratipally@users.noreply.github.com</email>
</author>
<published>2021-09-21T04:53:05+00:00</published>
<link rel='alternate' type='text/html' href='https://git.amelek.net/vyos/vyos-cloud-init.git/commit/?id=e27c30748e88409b1646a552f994edf9ed9d017e'/>
<id>urn:sha1:e27c30748e88409b1646a552f994edf9ed9d017e</id>
<content type='text'>
Add retries to DatasourceGCE when connecting to GCE.
Sometimes when the trying to fetch the metadata, 
cloud-init fails and the fallback datasource NoCloud is used which is
not expected. Add retries to ensure loading of the data source.</content>
</entry>
<entry>
<title>Allow user control over update events (#834)</title>
<updated>2021-05-13T17:55:41+00:00</updated>
<author>
<name>James Falcon</name>
<email>TheRealFalcon@users.noreply.github.com</email>
</author>
<published>2021-05-13T17:55:41+00:00</published>
<link rel='alternate' type='text/html' href='https://git.amelek.net/vyos/vyos-cloud-init.git/commit/?id=864346999702e6b2b8bf7e6244a6608bcead72a5'/>
<id>urn:sha1:864346999702e6b2b8bf7e6244a6608bcead72a5</id>
<content type='text'>
Control is currently limited to boot events, though this should
allow us to more easily incorporate HOTPLUG support. Disabling
'instance-first-boot' is not supported as we apply networking config
too early in boot to have processed userdata (along with the fact
that this would be a pretty big foot-gun).

The concept of update events on datasource has been split into
supported update events and default update events. Defaults will be
used if there is no user-defined update events, but user-defined
events won't be supplied if they aren't supported.
When applying the networking config, we now check to see if the event
is supported by the datasource as well as if it is enabled.

Configuration looks like:
updates:
  network:
    when: ['boot']</content>
</entry>
<entry>
<title>test: fix all flake8 E126 errors (#425)</title>
<updated>2020-06-10T14:39:29+00:00</updated>
<author>
<name>Joshua Powers</name>
<email>josh.powers@canonical.com</email>
</author>
<published>2020-06-10T14:39:29+00:00</published>
<link rel='alternate' type='text/html' href='https://git.amelek.net/vyos/vyos-cloud-init.git/commit/?id=f3bd42659efeed4b092ffcdfd5df7f24813f2d3e'/>
<id>urn:sha1:f3bd42659efeed4b092ffcdfd5df7f24813f2d3e</id>
<content type='text'>
</content>
</entry>
<entry>
<title>cloudinit: drop dependencies on unittest2 and contextlib2 (#322)</title>
<updated>2020-04-24T13:26:51+00:00</updated>
<author>
<name>Daniel Watkins</name>
<email>oddbloke@ubuntu.com</email>
</author>
<published>2020-04-24T13:26:51+00:00</published>
<link rel='alternate' type='text/html' href='https://git.amelek.net/vyos/vyos-cloud-init.git/commit/?id=38a7e6e9756fdab31264c0d6e93d20432ed111ac'/>
<id>urn:sha1:38a7e6e9756fdab31264c0d6e93d20432ed111ac</id>
<content type='text'>
These libraries provide backports of Python 3's stdlib components to Python 2. As we only support Python 3, we can simply use the stdlib now. This pull request does the following:

* removes some unneeded compatibility code for the old spelling of `assertRaisesRegex`
* replaces invocations of the Python 2-only `assertItemsEqual` with its new name, `assertCountEqual`
* replaces all usage of `unittest2` with `unittest`
* replaces all usage of `contextlib2` with `contextlib`
* drops `unittest2` and `contextlib2` from requirements files and tox.ini

It also rewrites some `test_azure` helpers to use bare asserts. We were seeing a strange error in xenial builds of this branch which appear to be stemming from the AssertionError that pytest produces being _different_ from the standard AssertionError.  This means that the modified helpers weren't behaving correctly, because they weren't catching AssertionErrors as one would expect. (I believe this is related, in some way, to https://github.com/pytest-dev/pytest/issues/645, but the only version of pytest where we're affected is so far in the past that it's not worth pursuing it any further as we have a workaround.)</content>
</entry>
<entry>
<title>sources/tests/test_init: drop use of deprecated inspect.getargspec (#285)</title>
<updated>2020-03-27T15:45:45+00:00</updated>
<author>
<name>Daniel Watkins</name>
<email>oddbloke@ubuntu.com</email>
</author>
<published>2020-03-27T15:45:45+00:00</published>
<link rel='alternate' type='text/html' href='https://git.amelek.net/vyos/vyos-cloud-init.git/commit/?id=1905ff47e9e688d9a48d6132fd45b341f2d66fe4'/>
<id>urn:sha1:1905ff47e9e688d9a48d6132fd45b341f2d66fe4</id>
<content type='text'>
</content>
</entry>
<entry>
<title>instance-data: add cloud-init merged_cfg and sys_info keys to json (#214)</title>
<updated>2020-03-10T14:22:22+00:00</updated>
<author>
<name>Chad Smith</name>
<email>chad.smith@canonical.com</email>
</author>
<published>2020-03-10T14:22:22+00:00</published>
<link rel='alternate' type='text/html' href='https://git.amelek.net/vyos/vyos-cloud-init.git/commit/?id=71af48df3514ca831c90b77dc71ba0a121dec401'/>
<id>urn:sha1:71af48df3514ca831c90b77dc71ba0a121dec401</id>
<content type='text'>
Cloud-config userdata provided as jinja templates are now distro,
platform and merged cloud config aware. The cloud-init query command
will also surface this config data.

Now users can selectively render portions of cloud-config based on:
* distro name, version, release
* python version
* merged cloud config values
* machine platform
* kernel

To support template handling of this config, add new top-level
keys to /run/cloud-init/instance-data.json.

The new 'merged_cfg' key represents merged cloud config from
/etc/cloud/cloud.cfg and /etc/cloud/cloud.cfg.d/*.

The new 'sys_info' key which captures distro and platform
info from cloudinit.util.system_info.

Cloud config userdata templates can render conditional content
based on these additional environmental checks such as the following
simple example:

```
  ## template: jinja
  #cloud-config
   runcmd:
  {% if distro == 'opensuse' %}
    - sh /custom-setup-sles
  {% elif distro == 'centos' %}
    - sh /custom-setup-centos
  {% elif distro == 'debian' %}
    - sh /custom-setup-debian
  {% endif %}
```

To see all values: sudo cloud-init query --all

Any keys added to the standardized v1 keys are guaranteed to not
change or drop on future released of cloud-init. 'v1' keys will be retained
for backward-compatibility even if a new standardized 'v2' set of keys
are introduced

The following standardized v1 keys are added:
* distro, distro_release, distro_version, kernel_version, machine,
python_version, system_platform, variant

LP: #1865969</content>
</entry>
<entry>
<title>instance-data: write redacted cfg to instance-data.json (#233)</title>
<updated>2020-03-04T22:19:43+00:00</updated>
<author>
<name>Chad Smith</name>
<email>chad.smith@canonical.com</email>
</author>
<published>2020-03-04T22:19:43+00:00</published>
<link rel='alternate' type='text/html' href='https://git.amelek.net/vyos/vyos-cloud-init.git/commit/?id=fa639704f67539d9c1d8668383f755cb0213fd4a'/>
<id>urn:sha1:fa639704f67539d9c1d8668383f755cb0213fd4a</id>
<content type='text'>
When cloud-init persisted instance metadata to instance-data.json               
if failed to redact the sensitive value. Currently, the only sensitive          
key 'security-credentials' is omitted as cloud-init does not fetch              
this value from IMDS.                                                           
                                                                                
Fix this by properly redacting the content from the public                      
instance-metadata.json file while retaining the value in the root-only          
instance-data-sensitive.json file.                                              
                                                                                
LP: #1865947</content>
</entry>
<entry>
<title>Drop most of the remaining use of six (#179)</title>
<updated>2020-01-21T23:02:42+00:00</updated>
<author>
<name>Daniel Watkins</name>
<email>oddbloke@ubuntu.com</email>
</author>
<published>2020-01-21T23:02:42+00:00</published>
<link rel='alternate' type='text/html' href='https://git.amelek.net/vyos/vyos-cloud-init.git/commit/?id=bb71a9d08d25193836eda91c328760305285574e'/>
<id>urn:sha1:bb71a9d08d25193836eda91c328760305285574e</id>
<content type='text'>
</content>
</entry>
<entry>
<title>util: json.dumps on python 2.7 will handle UnicodeDecodeError on binary</title>
<updated>2019-09-27T20:46:00+00:00</updated>
<author>
<name>Chad Smith</name>
<email>chad.smith@canonical.com</email>
</author>
<published>2019-09-27T20:46:00+00:00</published>
<link rel='alternate' type='text/html' href='https://git.amelek.net/vyos/vyos-cloud-init.git/commit/?id=067516d7bc917e4921b9f1424b7a64e92cae0ad2'/>
<id>urn:sha1:067516d7bc917e4921b9f1424b7a64e92cae0ad2</id>
<content type='text'>
Since python 2.7 doesn't handle UnicodeDecodeErrors with the default
handler

LP: #1801364
</content>
</entry>
</feed>
