Skip to content

Current implementation doesn't handle multi member stacks where versions of members are inconsistent #613

@lukebaldan

Description

@lukebaldan

Issue Type

  • Bug Report

Module Name

juniper.device.software
juniper.device collection and Python libraries version

Juniper device collection 1.0.2

ansible [core 2.14.2]
  config file = /project/junos_utils/tests/xgrade/ansible.cfg
  configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3.10/site-packages/ansible
  ansible collection location = /root/.ansible/collections:/usr/share/ansible/collections
  executable location = /usr/bin/ansible
  python version = 3.10.9 (main, Dec 12 2022, 17:52:15) [GCC 12.2.1 20220924] (/usr/bin/python3)
  jinja version = 3.1.2
  libyaml = False

ansible==7.2.0
ansible-core==2.14.2
awxkit==3.8.6
bcrypt==4.0.1
certifi==2022.12.7
cffi==1.15.1
charset-normalizer==3.0.1
cryptography==39.0.0
idna==3.4
Jinja2==3.1.2
junos-eznc==2.6.6
jxmlease==1.0.3
lxml==4.9.2
MarkupSafe==2.1.2
ncclient==0.6.13
netaddr==0.8.0
packaging==23.0
paramiko==3.0.0
pycparser==2.21
PyNaCl==1.5.0
pyparsing==3.0.9
pyserial==3.5
PyYAML==6.0
requests==2.28.2
resolvelib==0.8.1
scp==0.14.5
six==1.16.0
transitions==0.9.0
urllib3==1.26.14
xmltodict==0.13.0
yamlordereddictloader==0.4.0

OS / Environment

Juniper EX4200 configured with 3 members and following starting versions:

  • FPC0 (Master): 12.3R12-S12
  • FPC1 (Backup): 12.3R11.2
  • FPC2 (Linecard): 12.3R11.2

Summary

The existing juniper.device.software module seems to work fine if all members of the switch stack are on the same starting version.
If the current re (Member 0) is on version B and members 1 and 2 are on version A. Attempting an upgrade to version B will fail because of the following lines of code which checks the version of the current RE only.

Ideally the module should be able to upgrade all members of the stack regardless of their current version to the target version.

    if target_version is not None:
        if all_re is True:
            junos_info = facts['junos_info']
            for current_re in junos_info:
                current_version = junos_info[current_re]['text']
                if target_version != current_version:
                    junos_module.logger.debug("Current version on %s: %s. "
                                              "Target version: %s.",
                                              current_version, current_re,
                                              target_version)
                    results['changed'] = True
                else:
                    results['msg'] += "Current version on %s: %s same as Targeted " \
                                      "version: %s.\n" % (current_version, current_re,
                                                          target_version)

Steps to reproduce

    - name: Install Junos OS package
      juniper.device.software:
        reboot: false
        # For the purpose of this test, local package points to file containing 12.3R12-S12 release.
        local_package: "{{ pkg_dir }}/{{ chassis_model }}/{{ current_step_file }}"

Expected results

Expect Members 1 and 2 to be upgraded to 12.3R12-S12 to match master / member 0.


Actual results

Instead, debug reveals that current version is the same as targeted and the upgrade is not performed:

ok: [X] => {
"changed": false,
"check_mode": false,
"invocation": {
"module_args": {
"attempts": null,
"baud": null,
"checksum": null,
"checksum_algorithm": "md5",
"checksum_timeout": 300,
"cleanfs_timeout": 300,
"console": null,
"cs_passwd": null,
"cs_user": null,
"force_host": false,
"host": "10.x.x.x",
"huge_tree": false,
"issu": false,
"level": null,
"logdir": null,
"logfile": "/tmp/junosutils/files/logs/x.log",
"mode": null,
"nssu": false,
"passwd": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
"port": 830,
"ssh_config": null,
"ssh_private_key_file": null,
"timeout": 10,
"user": "x",
"validate": false,
"vmhost": false
}
},
"msg": "Current version on 12.3R12-S12: fpc0 same as Targeted version: 12.3R12-S12.\n"
}


Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions