This fixes a bug in the `network_connections` module when using the
`initscripts` provider and encountering a connection with `autoconnect`
set to false. It fails to write any `ONBOOT=` line to the interface's
`ifcfg-*` file, which RHEL treats as equivalent to `ONBOOT=yes`.
This explicitly sets `ONBOOT` for all interfaces defined, instead of
relying on what RHEL considers its default value.
This fixes this exception (issue #40):
[WARNING]: exception: Traceback (most recent call last): File
"/tmp/ansible_FfjjGk/ansible_module_network_connections.py", line 2812, in <module> cmd.run() File
"/tmp/ansible_FfjjGk/ansible_module_network_connections.py", line 2398, in run self.run_prepare() File
"/tmp/ansible_FfjjGk/ansible_module_network_connections.py", line 2653, in run_prepare if connection['type'] in [
'macvlan' ]: KeyError: 'type'
Bytestrings need to be decoded. Just use UTF-8 here, since everyone
should be using it. Also add a test case to catch this. The exception
was:
TypeError: cannot use a string pattern on a bytes-like object
Like for 'bond' and 'ethernet', don't merge the infiniband specific property
in the top-level. Instead, nest them under 'infiniband'.
This duplicates and deprecates the existing infiniband settings, but the old
parameters are still supported.
Like for 'bond' and 'ethernet', don't merge the vlan specific property
in the top-level. Instead, nest them under 'vlan'.
This duplicates and deprecates the existing 'vlan_id', but the old
parameter is still supported.
run() supports a --check mode (DRY_RUN) and a real mode,
where the real mode consists of a PRE_RUN that only simulates
the steps and a REAL_RUN.
Actualy changes can only happen during REAL_RUN (and we pretend
that they happen during DRY_RUN).
Fix handling of the change flag, is was broken previously.
Also, we need to set the is-changed flag to True before actually
invoking the action. Because, if we fail, we might fail_json()
right away, and need to correct changed flag.
Now, that we only create the AnsibleUtil instance when we already
know that we run under ansible (not from unit tests), we can avoid
initializing the AnsibleModule lazily.
It works like 'route_append_only' and can be used to prevent
the role from deleting rule files. That makes especaily sense,
because the role currently doesn't support routing rules.
Also, NetworkManager still doesn't support routing rules either.
One day, the role (and maybe NetworkManager) will support rules,
and at that point it will start configuring them. That is the
reason why the new option already defaults to 'False'. Because,
once we add support for rules, we want the role to manage them
by default.
Depending on the provider, we have additional restrictions on the
input arguments. Validate them early.
Without this, we will only fail later when we want to get the
'interface_name' of a parent or a master profile. Fail early.
The major reason for this, is to expose this validation so that
it can be used by unit tests, to check whether proceeding will
lead to a known failure.
Addresses (currently) have only few properties, so this might
not make too much sense in the first moment. However, we will
add routes, which have lots of properties.
To support routes, we will treat them as dictionaries, not string
entries. Hence, for consistency, allow that syntax for addresses as
well.