mirror of
https://github.com/linux-system-roles/network.git
synced 2026-01-23 10:25:28 +00:00
tests: Adjust profile path if necessary
If /etc/network-scripts does no exist, NeworkManger uses /etc/NetworkManager/system-connections to store profiles. Use this directory if necessary.
This commit is contained in:
parent
5273f55166
commit
f8d325f9fa
3 changed files with 28 additions and 16 deletions
|
|
@ -1,13 +1,6 @@
|
|||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
---
|
||||
- name: set variable
|
||||
set_fact:
|
||||
profile_path: /etc/sysconfig/network-scripts/ifcfg-{{ profile }}
|
||||
- name: stat profile file
|
||||
stat:
|
||||
path: "{{ profile_path }}"
|
||||
register: profile_stat
|
||||
|
||||
- include: get-profile_stat.yml
|
||||
- name: "assert that profile '{{ profile }}' is absent"
|
||||
assert:
|
||||
that: not profile_stat.stat.exists
|
||||
|
|
|
|||
|
|
@ -1,13 +1,6 @@
|
|||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
---
|
||||
- name: set variable
|
||||
set_fact:
|
||||
profile_path: /etc/sysconfig/network-scripts/ifcfg-{{ profile }}
|
||||
- name: stat profile file
|
||||
stat:
|
||||
path: "{{ profile_path }}"
|
||||
register: profile_stat
|
||||
|
||||
- include: get-profile_stat.yml
|
||||
- name: "assert that profile '{{ profile }}' is present"
|
||||
assert:
|
||||
that: profile_stat.stat.exists
|
||||
|
|
|
|||
26
tests/tasks/get-profile_stat.yml
Normal file
26
tests/tasks/get-profile_stat.yml
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
---
|
||||
- name: "Get stat for network-scripts"
|
||||
stat:
|
||||
get_attributes: false
|
||||
get_checksum: false
|
||||
get_mime: false
|
||||
path: "/etc/sysconfig/network-scripts"
|
||||
register: network_scripts_stat
|
||||
- name: Set profile path (network-scripts)
|
||||
set_fact:
|
||||
profile_path: /etc/sysconfig/network-scripts/ifcfg-{{ profile }}
|
||||
when:
|
||||
- network_scripts_stat.stat.exists
|
||||
- name: Set profile path (NetworkManager system-connections)
|
||||
set_fact:
|
||||
profile_path: /etc/NetworkManager/system-connections/{{ profile }}
|
||||
when:
|
||||
- not network_scripts_stat.stat.exists
|
||||
- name: stat profile file
|
||||
stat:
|
||||
get_attributes: false
|
||||
get_checksum: false
|
||||
get_mime: false
|
||||
path: "{{ profile_path }}"
|
||||
register: profile_stat
|
||||
Loading…
Add table
Add a link
Reference in a new issue