Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
liangwen12year opened this issue Mar 18, 2021 · 0 comments

Comments

@liangwen12year
Copy link
Collaborator

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

@tyll tyll linked a pull request Mar 18, 2021 that will close this issue
@liangwen12year liangwen12year changed the title Need to convert sexagesimal number back into mac address because of yaml's peculiarity Need to convert number back into mac address because of yaml's peculiarity Mar 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant