mirror of
https://github.com/linux-system-roles/network.git
synced 2026-01-23 02:15:17 +00:00
test,library: add example playbooks and bug fixes
This commit is contained in:
parent
8c69f5b851
commit
9c3b2ad422
2 changed files with 41 additions and 3 deletions
38
TEST/test-playbook-3.yml
Normal file
38
TEST/test-playbook-3.yml
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
---
|
||||
- hosts: network-test
|
||||
vars:
|
||||
network:
|
||||
connections:
|
||||
- name: p-3-auto
|
||||
autoconnect: no
|
||||
interface_name: eth0
|
||||
type: ethernet
|
||||
- name: p-3-auto
|
||||
|
||||
|
||||
- name: p-3-manual
|
||||
autoconnect: no
|
||||
interface_name: eth0
|
||||
type: ethernet
|
||||
ip:
|
||||
dhcp4: no
|
||||
gateway4: 192.168.122.1
|
||||
address:
|
||||
- 192.168.122.97/24
|
||||
- name: p-3-manual
|
||||
|
||||
|
||||
- name: p-3-br0
|
||||
autoconnect: no
|
||||
interface_name: br0
|
||||
type: bridge
|
||||
- name: p-3-br0-eth0
|
||||
autoconnect: no
|
||||
interface_name: eth0
|
||||
type: ethernet
|
||||
slave_type: bridge
|
||||
master: p-3-br0
|
||||
- name: p-3-br0-eth0
|
||||
|
||||
roles:
|
||||
- network
|
||||
|
|
@ -771,8 +771,8 @@ class NMCmd:
|
|||
if len(cons) != 1:
|
||||
raise Exception('a unique %s connection "%s" was not found, instead there are [ %s ]' % (field, args[field], ' '.join([c.get_uuid() for c in cons])))
|
||||
con = cons[0]
|
||||
if expected_type is not None and con.get_type() != expected_type:
|
||||
raise Exception('the %s connection "%s" is expected to be of type %s but is %s (%s)' % (field, args[field], expected_type, con.get_type(), con.get_uuid()))
|
||||
if expected_type is not None and con.get_connection_type() != expected_type:
|
||||
raise Exception('the %s connection "%s" is expected to be of type %s but is %s (%s)' % (field, args[field], expected_type, con.get_connection_type(), con.get_uuid()))
|
||||
return con
|
||||
|
||||
def connection_find_master(self, args, field, check_mode = False, expected_type = None):
|
||||
|
|
@ -872,7 +872,7 @@ class NMCmd:
|
|||
|
||||
if 'slave_type' in args:
|
||||
s_con.set_property(NM.SETTING_CONNECTION_SLAVE_TYPE, args['slave_type'])
|
||||
m = self.connection_find_master(args, 'master', check_mode)
|
||||
m = self.connection_find_master(args, 'master', check_mode, args['slave_type'])
|
||||
if m is None:
|
||||
dirty = True
|
||||
else:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue