linux-system-roles / network

An ansible role to configure networking

Home Page:https://linux-system-roles.github.io/network/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Need to convert number back into mac address because of yaml's peculiarity

liangwen12year opened this issue · comments

I define the mac: 52:54:00:12:34:56, because the mac in VM is:

[root@localhost ~]# ip link
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP mode DEFAULT group default qlen 1000
    link/ether 52:54:00:12:34:56 brd ff:ff:ff:ff:ff:ff

playbook:

---
- hosts: all
  vars:
    network_connections:
      - name: eth0
        type: ethernet
        autoconnect: yes
        mac: 52:54:00:12:34:56
        ip:
         dhcp4: yes
  roles:
    - linux-system-roles.network
...


cmd to run the test:
[wenliang@localhost network]$ TEST_DEBUG=1 TEST_SUBJECTS=Fedora-Cloud-Base-33-20210106.0.x86_64.qcow2 ansible-playbook -vv -i /usr/share/ansible/inventory/standard-inventory-qcow2 ./examples/wl_test1.yml --skip-tags tests::cleanup -e network_provider=nm


test result:

TASK [linux-system-roles.network : Configure networking connection profiles] ******************************************************************************************************************
task path: /home/wenliang/network/tests/roles/linux-system-roles.network/tasks/main.yml:81
fatal: [Fedora-Cloud-Base-33-20210106.0.x86_64.qcow2]: FAILED! => {"_invocation": {"module_args": {"__debug_flags": "", "connections": [{"autoconnect": true, "ip": {"dhcp4": true}, "mac": 41135085296, "name": "eth0", "type": "ethernet"}], "force_state_change": false, "ignore_errors": false, "provider": "nm"}}, "changed": false, "msg": "fatal error: configuration error: connections[0].mac: must be a string but is '41135085296'", "stderr": "\n", "stderr_lines": [""]}

The hint for resolving this bug:
https://stackoverflow.com/questions/52732222/in-the-yaml-format-file-as-test-yaml-some-mac-addresses-will-be-judged-as-numbe