F5Networks / f5-ansible

Imperative Ansible modules for F5 BIG-IP products
GNU General Public License v3.0
375 stars 231 forks source link

RFE for module for upgrading VCMP guests #1680

Closed arunganti closed 4 years ago

arunganti commented 4 years ago
ISSUE TYPE
COMPONENT NAME

new module

ANSIBLE VERSION
2.9.5
PYTHON VERSION
2.7.16
BIGIP VERSION
13.1.X
OS / ENVIRONMENT

MAC OS

SUMMARY

RFE for module for upgrading VCMP guests

"bigip_software_install" module does not work for VCMP guests.When the module is tested against VCMP guest, it gives the error "TypeError: 'NoneType' object is not subscriptable"

STEPS TO REPRODUCE

There is a subtle difference in the iControl Rest responds on a VCMP guest that won’t work with the way the module is currently written. The images are on the VCMP host rather than the VCMP guest, so the images section will return as empty in case of VCMP guests.

For example,

[root@qa-nyc:/S1-green-P::Active:Standalone] config # restcurl -u admin:xxxxx /mgmt/tm/sys/software/image { "kind": "tm:sys:software:image:imagecollectionstate", "selfLink": "https://localhost/mgmt/tm/sys/software/image?ver\u003d13.1.0" }

A BIG-IP which is not a VCMP guest will answer with an ‘items’ array containing possible images.

{ "kind": "tm:sys:software:image:imagecollectionstate", "selfLink": "https://localhost/mgmt/tm/sys/software/image?ver=12.1.2", "items": [ { "kind": "tm:sys:software:image:imagestate", "name": "13.1.0.iso/1", "fullPath": "13.1.0.iso/1", "generation": 46, "selfLink": "https://localhost/mgmt/tm/sys/software/image/13.1.0.iso~1?ver=12.1.2", "build": "0.0.1868", "buildDate": "Fri Nov 10 17 27 22 PST 2017", "checksum": "e0b5dbd341d942d8802ffb033ecd2f43", "fileSize": "1913 MB", "lastModified": "Fri Feb 14 02:15:55 2020", "product": "BIG-IP", "verified": "yes", "version": "13.1.0" }, ... { "kind": "tm:sys:software:image:imagestate", "name": "BIGIP-12.1.2.0.0.249.iso/3", "fullPath": "BIGIP-12.1.2.0.0.249.iso/3", "generation": 609, "selfLink": "https://localhost/mgmt/tm/sys/software/image/BIGIP-12.1.2.0.0.249.iso~3?ver=12.1.2", "build": "0.0.249", "buildDate": "Wed Nov 30 16 04 00 PST 2016", "checksum": "8c1eb9ea4d3168bb03c41e6220d4f31e", "fileSize": "2011 MB", "lastModified": "Fri Jan 31 17:36:23 2020", "product": "BIG-IP", "verified": "yes", "version": "12.1.2" } ] }

In the module, if you follow the ModuleParameters class you’ll see where the version parameter on the self object gets set (line 150). Having no item property (or no images in that property) will result in:

self._values['version'] = self.image_info['version']

Since self.image_info is None you get the error:

TypeError: 'NoneType' object is not subscriptable

For VCMP guests, we need to obtain this information "/mgmt/tm/sys/software/image" from the VCMP host.

focrensh commented 4 years ago

Tracking with FMFA-453