mirror of
https://github.com/ansible/awx.git
synced 2026-03-09 13:39:27 -02:30
Preventing error if we were unable to get an API version
This commit is contained in:
committed by
beeankha
parent
c085397bcb
commit
d4971eb7b7
@@ -261,22 +261,25 @@ class ControllerAPIModule(ControllerModule):
|
|||||||
controller_version = response.info().getheader('X-API-Product-Version', None)
|
controller_version = response.info().getheader('X-API-Product-Version', None)
|
||||||
|
|
||||||
parsed_collection_version = Version(self._COLLECTION_VERSION).version
|
parsed_collection_version = Version(self._COLLECTION_VERSION).version
|
||||||
parsed_controller_version = Version(controller_version).version
|
if(not controller_version):
|
||||||
if controller_type == 'AWX':
|
self.warn("You are using the {0} version of this collection but connecting to a controller that did not return a version".format(self._COLLECTION_TYPE))
|
||||||
collection_compare_ver = parsed_collection_version[0]
|
|
||||||
controller_compare_ver = parsed_controller_version[0]
|
|
||||||
else:
|
else:
|
||||||
collection_compare_ver = "{0}.{1}".format(parsed_collection_version[0], parsed_collection_version[1])
|
parsed_controller_version = Version(controller_version).version
|
||||||
controller_compare_ver = '{0}.{1}'.format(parsed_controller_version[0], parsed_controller_version[1])
|
if controller_type == 'AWX':
|
||||||
|
collection_compare_ver = parsed_collection_version[0]
|
||||||
|
controller_compare_ver = parsed_controller_version[0]
|
||||||
|
else:
|
||||||
|
collection_compare_ver = "{0}.{1}".format(parsed_collection_version[0], parsed_collection_version[1])
|
||||||
|
controller_compare_ver = '{0}.{1}'.format(parsed_controller_version[0], parsed_controller_version[1])
|
||||||
|
|
||||||
if self._COLLECTION_TYPE not in self.collection_to_version or self.collection_to_version[self._COLLECTION_TYPE] != controller_type:
|
if self._COLLECTION_TYPE not in self.collection_to_version or self.collection_to_version[self._COLLECTION_TYPE] != controller_type:
|
||||||
self.warn("You are using the {0} version of this collection but connecting to {1}".format(self._COLLECTION_TYPE, controller_type))
|
self.warn("You are using the {0} version of this collection but connecting to {1}".format(self._COLLECTION_TYPE, controller_type))
|
||||||
elif collection_compare_ver != controller_compare_ver:
|
elif collection_compare_ver != controller_compare_ver:
|
||||||
self.warn(
|
self.warn(
|
||||||
"You are running collection version {0} but connecting to {2} version {1}".format(
|
"You are running collection version {0} but connecting to {2} version {1}".format(
|
||||||
self._COLLECTION_VERSION, controller_version, controller_type
|
self._COLLECTION_VERSION, controller_version, controller_type
|
||||||
|
)
|
||||||
)
|
)
|
||||||
)
|
|
||||||
|
|
||||||
self.version_checked = True
|
self.version_checked = True
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user