Merge ~vikaskrishnan/charm-ubuntu-advantage:bugfix-2038699 into charm-ubuntu-advantage:master

Proposed by Vikas Krishnan Radhakrishnan
Status: Merged
Merged at revision: 57e97bf1043e3aeec52cec0a091e14655dc1b0d6
Proposed branch: ~vikaskrishnan/charm-ubuntu-advantage:bugfix-2038699
Merge into: charm-ubuntu-advantage:master
Diff against target: 27 lines (+5/-5)
1 file modified
src/charm.py (+5/-5)
Reviewer Review Type Date Requested Status
Allan Vidal Approve
Kian Parvin Approve
Review via email: mp+454075@code.launchpad.net

Commit message

Update contract_url before querying pro (ubuntu-advantage) status

Description of the change

This bugfix updates the contract server configuration from the 'contract_url' config option BEFORE querying the pro (ubuntu-advantage) status, preventing timeout-related errors during the config-changed event. This fix is particularly necessary for airgapped (offline) deployments where the public contract URL "contracts.canonical.com" is unreachable by default.

To post a comment you must log in.
Revision history for this message
🤖 Canonical IS Merge Bot (canonical-is-mergebot) wrote :

This merge proposal is being monitored by mergebot. Change the status to Approved to merge.

Revision history for this message
Lucas Albuquerque Medeiros de Moura (lamoura) :
Revision history for this message
Kian Parvin (kian-parvin) :
review: Approve
Revision history for this message
Allan Vidal (alnvdl) wrote :

This makes sense, the proxy and server configuration should probably be done closely together, before any attempt to use the Pro client.

review: Approve
Revision history for this message
Allan Vidal (alnvdl) :
Revision history for this message
Vikas Krishnan Radhakrishnan (vikaskrishnan) :

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/src/charm.py b/src/charm.py
2index 1f54e8a..3031f9b 100755
3--- a/src/charm.py
4+++ b/src/charm.py
5@@ -145,17 +145,17 @@ class UbuntuAdvantageCharm(CharmBase):
6 # as well as regular tool operations.
7 self._configure_ua_proxy()
8
9+ if config_changed:
10+ logger.info("Updating uaclient.conf")
11+ update_configuration(contract_url)
12+ self._state.contract_url = contract_url
13+
14 status = get_status_output()
15 if status["attached"] and (config_changed or token_changed):
16 logger.info("Detaching ubuntu-advantage subscription")
17 detach_subscription()
18 self._state.hashed_token = None
19
20- if config_changed:
21- logger.info("Updating uaclient.conf")
22- update_configuration(contract_url)
23- self._state.contract_url = contract_url
24-
25 if not token:
26 self.unit.status = BlockedStatus("No token configured")
27 return

Subscribers

People subscribed via source and target branches