ansible-collections / ansible.netcommon

Ansible Network Collection for Common Code
GNU General Public License v3.0
141 stars 103 forks source link

netconf_config false argument when using confirm_commit #551

Open Dalle55 opened 1 year ago

Dalle55 commented 1 year ago
SUMMARY

Getting the following error when enabling commit with or without confirm_commit:

false, "msg": "Argument must be bytes or unicode, got 'int'"}

I have seen bug reports on the same on previous ansible version 2.9 and 2.7 - we are on 2.13

it is the waiting time specified under "commit: 10" that fails But also fails to identify "confirm_commit: true" or "confirm_commit: yes"

ISSUE TYPE
COMPONENT NAME

netconf_config

ANSIBLE VERSION
$ ansible --version
ansible [core 2.13.4]
python version = 3.8.10
COLLECTION VERSION
Collection        Version
----------------- -------
ansible.netcommon 3.1.1
CONFIGURATION
ANSIBLE_FORCE_COLOR(/home/voldby/git/SSN-4.9/ssn-4-platform/automation/ansible/configuration/ansible.cfg) = True
DEFAULT_HOST_LIST(/home/voldby/git/SSN-4.9/ssn-4-platform/automation/ansible/configuration/ansible.cfg) = ['/home/voldby/git/SSN-4.9/network-lab-inventory/DKBB2/inventory']
DEFAULT_LOG_PATH(/home/voldby/git/SSN-4.9/ssn-4-platform/automation/ansible/configuration/ansible.cfg) = /home/voldby/git/SSN-4.9/ssn-4-platform/automation/log/ansible overrule ans>
DEFAULT_TIMEOUT(/home/voldby/git/SSN-4.9/ssn-4-platform/automation/ansible/configuration/ansible.cfg) = 5
HOST_KEY_CHECKING(/home/voldby/git/SSN-4.9/ssn-4-platform/automation/ansible/configuration/ansible.cfg) = False
OS / ENVIRONMENT

Ansible running on: Ubuntu 20.04.5 LTS target network device: cisco IE-3300-8T2S target firmware; 17.9.3

target network device support for confirmed_commit

urn:ietf:params:netconf:capability:confirmed-commit:1.1 urn:ietf:params:netconf:capability:confirmed-commit:1.0 urn:ietf:params:netconf:capability:candidate:1.0

STEPS TO REPRODUCE
- name: Configure /native/ip/domain
  tags:
    - ip
    - domain
  netconf_config:
    target: candidate
    format: xml
    lock: never
    commit: yes
    confirm: 10
    get_filter: "/native/ip/domain"
    content: "{{ lookup('template', 'native_ip_domain.j2') }}"
  register: result
  until: result is not failed
  retries: "{{ DEFAULT_RETRIES }}"
  delay: "{{ DEFAULT_DELAY }}"
EXPECTED RESULTS

I expected confim_commit succes

ACTUAL RESULTS
fatal: [DKBB2-SWP-WTG001-NA-SW01]: FAILED! => {"attempts": 5, "changed": false, "msg": "Argument must be bytes or unicode, got 'int'"}
Dalle55 commented 1 year ago

I have also tried the following:

- name: Configure devices
  tags: 
    - ip
    - domain
  netconf_config:
    get_filter: "/native/ip/domain"
    content: "{{ lookup('template', 'native_ip_domain.j2') }}"
    format: xml
    target: candidate
    lock: never
    confirm: 10
  register: result
  until: result is not failed
  retries: "{{ DEFAULT_RETRIES }}"
  delay: "{{ DEFAULT_DELAY }}"

- name: Confirm a previous commit
  tags:
    - ip
    - domain
  netconf_config:
    lock: never
    confirm_commit: yes
Dalle55 commented 1 year ago

Update: Tried to upgrade ansible and collections yesterday, but have the same issue:

ansible [core 2.13.10]
  config file = /home/voldby/git/SSN-4.9/ssn-4-platform/automation/ansible/configuration/ansible.cfg
  configured module search path = ['/home/voldby/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /home/voldby/.local/lib/python3.8/site-packages/ansible
  ansible collection location = /home/voldby/.ansible/collections:/usr/share/ansible/collections
  executable location = /home/voldby/.local/bin/ansible
  python version = 3.8.10 (default, May 26 2023, 14:05:08) [GCC 9.4.0]
  jinja version = 3.1.2
  libyaml = True

Collection

# /home/voldby/.local/lib/python3.8/site-packages/ansible_collections
Collection        Version
----------------- -------
ansible.netcommon 3.1.3  

# /home/voldby/.ansible/collections/ansible_collections
Collection        Version
----------------- -------
ansible.netcommon 5.1.1
Dalle55 commented 12 months ago

Any updates on this? :)

Still getting: fatal: [DKBB2-SWP-WTG001-NA-SW01]: FAILED! => {"attempts": 5, "changed": false, "msg": "Argument must be bytes or unicode, got 'int'"}

When adding "confirm: 10"

Dalle55 commented 11 months ago

Tried to add unicode instead of int. Now it fails because it says it cannot convert the unicode to int.

msg": "argument 'confirm' is of type <class 'ansible.parsing.yaml.objects.AnsibleUnicode'> and we were unable to convert to int: <class 'ansible.parsing.yaml.objects.AnsibleUnicode'> cannot be converted to an int"}

Dalle55 commented 11 months ago

You have previously fixed it for ios-xr here: https://github.com/ansible-collections/cisco.iosxr/issues/74

Dalle55 commented 4 months ago

BUMP - ticket still valid