Hotfix charmhelpers sync for local_address() fix
The network-get --primary-address juju-info fails on pre-2.8.? versions of juju. This results in a NoNetworkBinding error. Fallback to unit_get() if that occurs for local_address(). Change-Id: I1faf793d433e1a0c61b8ad8efd1291cd77133ff6
This commit is contained in:
		| @@ -130,6 +130,9 @@ def local_address(unit_get_fallback='public-address'): | |||||||
|     from network-get. If this is running with an old version of Juju then |     from network-get. If this is running with an old version of Juju then | ||||||
|     fallback to unit_get. |     fallback to unit_get. | ||||||
|  |  | ||||||
|  |     Note on juju < 2.9 the binding to juju-info may not exist, so fall back to | ||||||
|  |     the unit-get. | ||||||
|  |  | ||||||
|     :param unit_get_fallback: Either 'public-address' or 'private-address'. |     :param unit_get_fallback: Either 'public-address' or 'private-address'. | ||||||
|                               Only used with old versions of Juju. |                               Only used with old versions of Juju. | ||||||
|     :type unit_get_fallback: str |     :type unit_get_fallback: str | ||||||
| @@ -138,7 +141,7 @@ def local_address(unit_get_fallback='public-address'): | |||||||
|     """ |     """ | ||||||
|     try: |     try: | ||||||
|         return network_get_primary_address('juju-info') |         return network_get_primary_address('juju-info') | ||||||
|     except NotImplementedError: |     except (NotImplementedError, NoNetworkBinding): | ||||||
|         return unit_get(unit_get_fallback) |         return unit_get(unit_get_fallback) | ||||||
|  |  | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Alex Kavanagh
					Alex Kavanagh