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

fix stack_model and stack_serialnum case matching #40928

Merged
merged 1 commit into from
Jun 6, 2018
Merged

fix stack_model and stack_serialnum case matching #40928

merged 1 commit into from
Jun 6, 2018

Conversation

epicanthal
Copy link
Contributor

Account for upper/lower case match occurrences of "[Nn]umber" and "[Ss]erial"

Model Number : WS-C3850-12X48U
System Serial Number :

SUMMARY

For stack type switches, string matching for "Model number" and "serial number" need to account for upper and lower case. "Number" or "number", and "Serial" or "serial" are all valid depending on switch model and/or IOS version.

ISSUE TYPE
  • Bugfix Pull Request
COMPONENT NAME

ios_facts

ANSIBLE VERSION
ansible 2.7.0dev0
  config file = /home/vagrant/ansible.cfg
  configured module search path = [u'/home/vagrant/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/local/lib/python2.7/dist-packages/ansible
  executable location = /usr/local/bin/ansible
  python version = 2.7.12 (default, Dec  4 2017, 14:50:18) [GCC 5.4.0 20160609]

ADDITIONAL INFORMATION

BEFORE CHANGES:

  • A 3750X-48 (IOS 12.2(55)SE7) stack works, i.e. the models and serial #'s are returned as the strings "Model number" and "System serial number" are matched.
  • Both C3850-48U (IOS 03.07.03E) and 3850-12X48U (IOS 03.07.05) stacks do not work, i.e. the models and serial #'s ARE NOT returned as the strings "Model Number" and "System Serial Number" ARE NOT matched.

AFTER CHANGES: All three scenarios of 3750X-48, 3850-48U and 3850-12X48U return models and serial #s as expected.

**** BEFORE AND AFTER CHANGE with 3750X-48 (12.2(55)SE7) ****
TASK [debug ansible_net_version] ***********************************************
ok: [hostname removed] => {
    "hostvars[inventory_hostname]['ansible_net_version']": "12.2(55)SE7"
}

TASK [debug ansible_net_stacked_models] ****************************************
ok: [hostname removed] => {
    "hostvars[inventory_hostname]['ansible_net_stacked_models']": [
        "WS-C3750X-48PF-S", 
        "WS-C3750X-48PF-S", 
        "WS-C3750X-48PF-S", 
        "WS-C3750X-48PF-S"
    ]
}

TASK [debug ansible_net_stacked_serialnums] ************************************
ok: [hostname removed] => {
    "hostvars[inventory_hostname]['ansible_net_stacked_serialnums']": [
        "FXXXXXXXXX1", 
        "FXXXXXXXXX2", 
        "FXXXXXXXXX3", 
        "FXXXXXXXXX4", 
    ]
}


**** BEFORE CHANGE with 3850-12X48U (03.07.05) ****
TASK [debug ansible_net_version] ***********************************************
ok: [hostname removed] => {
    "hostvars[inventory_hostname]['ansible_net_version']": "03.07.05E"
}

TASK [debug ansible_net_stacked_models] ****************************************
ok: [hostname removed] => {
    "hostvars[inventory_hostname]['ansible_net_stacked_models']": "VARIABLE IS NOT DEFINED!"
}

TASK [debug ansible_net_stacked_serialnums] ************************************
ok: [hostname removed] => {
    "hostvars[inventory_hostname]['ansible_net_stacked_serialnums']": "VARIABLE IS NOT DEFINED!"
}

**** AFTER CHANGE with 3850-12X48U (03.07.05) ****
TASK [debug ansible_net_version] ***********************************************
ok: [hostname removed] => {
    "hostvars[inventory_hostname]['ansible_net_version']": "03.07.05E"
}

TASK [debug ansible_net_stacked_models] ****************************************
ok: [hostname removed] => {
    "hostvars[inventory_hostname]['ansible_net_stacked_models']": [
        "WS-C3850-12X48U", 
        "WS-C3850-12X48U", 
        "WS-C3850-12X48U", 
        "WS-C3850-12X48U", 
        "WS-C3850-12X48U", 
        "WS-C3850-12X48U", 
        "WS-C3850-12X48U"
    ]
}

TASK [debug ansible_net_stacked_serialnums] ************************************
ok: [hostname removed] => {
    "hostvars[inventory_hostname]['ansible_net_stacked_serialnums']": [
        "FXXXXXXXXX1", 
        "FXXXXXXXXX2", 
        "FXXXXXXXXX3", 
        "FXXXXXXXXX4", 
        "FXXXXXXXXX5", 
        "FXXXXXXXXX6", 
        "FXXXXXXXXX7"
    ]
}

Account for upper/lower case match occurrences of "[Nn]umber" and "[Ss]erial"

Model Number                       : WS-C3850-12X48U
System Serial Number          :  <removed>
@ansibot
Copy link
Contributor

ansibot commented May 31, 2018

@ansibot ansibot added affects_2.7 This issue/PR affects Ansible v2.7 bug This issue/PR relates to a bug. core_review In order to be merged, this PR must follow the core review workflow. module This issue/PR relates to a module. needs_triage Needs a first human triage before being processed. networking Network category new_contributor This PR is the first contribution by a new community member. support:network This issue/PR relates to code supported by the Ansible Network Team. labels May 31, 2018
@mkrizek mkrizek removed the needs_triage Needs a first human triage before being processed. label Jun 1, 2018
@Qalthos Qalthos merged commit 12d2211 into ansible:devel Jun 6, 2018
Qalthos pushed a commit to Qalthos/ansible that referenced this pull request Jun 6, 2018
Account for upper/lower case match occurrences of "[Nn]umber" and "[Ss]erial"

Model Number                       : WS-C3850-12X48U
System Serial Number          :  <removed>

(cherry picked from commit 12d2211)
Qalthos pushed a commit to Qalthos/ansible that referenced this pull request Jun 6, 2018
Account for upper/lower case match occurrences of "[Nn]umber" and "[Ss]erial"

Model Number                       : WS-C3850-12X48U
System Serial Number          :  <removed>

(cherry picked from commit 12d2211)
mattclay pushed a commit that referenced this pull request Jun 7, 2018
Account for upper/lower case match occurrences of "[Nn]umber" and "[Ss]erial"

Model Number                       : WS-C3850-12X48U
System Serial Number          :  <removed>

(cherry picked from commit 12d2211)
nitzmahone pushed a commit that referenced this pull request Jun 8, 2018
* Do not gather mem facts if command invalid (#40820)

* Do not gather mem facts if command invalid

In some firmwares, 'show memory statistics' fail, thus
do not populate mem if we got a failure after running that command.

* Fix pep8

* Warn if got error when running 'sh memory statistics'

* Fix pep8

(cherry picked from commit 669949e)

* Update ios_facts.py (#40928)

Account for upper/lower case match occurrences of "[Nn]umber" and "[Ss]erial"

Model Number                       : WS-C3850-12X48U
System Serial Number          :  <removed>

(cherry picked from commit 12d2211)

* Expand ios password prompt regex (#41131)


(cherry picked from commit 49fddb6)
jacum pushed a commit to jacum/ansible that referenced this pull request Jun 26, 2018
Account for upper/lower case match occurrences of "[Nn]umber" and "[Ss]erial"

Model Number                       : WS-C3850-12X48U
System Serial Number          :  <removed>
@Noname2244
Copy link

Is this pushed into the 2.6 release ?

@ansible ansible locked and limited conversation to collaborators Jun 11, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
affects_2.7 This issue/PR affects Ansible v2.7 bug This issue/PR relates to a bug. core_review In order to be merged, this PR must follow the core review workflow. module This issue/PR relates to a module. networking Network category new_contributor This PR is the first contribution by a new community member. support:network This issue/PR relates to code supported by the Ansible Network Team.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants