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

Added support for vmSettings' ETag #2294

Merged
merged 2 commits into from
Jul 6, 2021
Merged

Conversation

narrieta
Copy link
Member

@narrieta narrieta commented Jul 2, 2021

Use the ETag of the vmSettings API; update extensions goal state only if the ETag changed.

@narrieta
Copy link
Member Author

narrieta commented Jul 2, 2021

@jscalev FYI

@codecov
Copy link

codecov bot commented Jul 2, 2021

Codecov Report

Merging #2294 (ada2701) into fast-track (89c1a80) will increase coverage by 0.01%.
The diff coverage is 82.85%.

Impacted file tree graph

@@              Coverage Diff               @@
##           fast-track    #2294      +/-   ##
==============================================
+ Coverage       70.60%   70.62%   +0.01%     
==============================================
  Files              96       97       +1     
  Lines           13917    13939      +22     
  Branches         1986     1991       +5     
==============================================
+ Hits             9826     9844      +18     
- Misses           3656     3659       +3     
- Partials          435      436       +1     
Impacted Files Coverage Δ
azurelinuxagent/common/protocol/wire.py 77.91% <78.57%> (-0.26%) ⬇️
...inuxagent/common/protocol/extensions_goal_state.py 100.00% <100.00%> (ø)
azurelinuxagent/ga/update.py 87.67% <100.00%> (ø)
azurelinuxagent/ga/collect_telemetry_events.py 90.41% <0.00%> (+0.68%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 89c1a80...ada2701. Read the comment docs.

@@ -666,7 +670,7 @@ def fetch_manifest(self, version_uris, timeout_in_minutes=5, timeout_in_ms=0):
logger.verbose('The specified manifest URL is empty, ignored.')
continue

direct_func = lambda: self.fetch(version.uri, max_retry=1) # pylint: disable=W0640
direct_func = lambda: self.fetch(version.uri, max_retry=1)[0] # pylint: disable=W0640
# NOTE: the host_func may be called after refreshing the goal state, be careful about any goal state data
# in the lambda.
host_func = lambda: self.fetch_manifest_through_host(version.uri) # pylint: disable=W0640
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a pitfall here that might be a good idea to document. direct_func and host_func both reference version.uri, but version is a mutating variable declared in a loop. Thus, after the loop, all the lambdas will use the last version.uri in version_uris_shuffled. See the pylint page for more info (just Ctrl+F for W0640). I believe this isn't an issue right now because we only access these lambdas from inside the loop, but any future code that somehow tries to export a particular direct_func/host_func would run into a pretty hard to debug error. Might be worth a code comment.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We create a new closure in each iteration of the loop, so this is not an issue. I can add a comment explaining the suppression on a subsequent PR.

Copy link
Contributor

@kevinclark19a kevinclark19a left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left a single unresolved comment above about documenting a pitfall, but everything looks good to me, overall.

@narrieta narrieta merged commit b8afae7 into Azure:fast-track Jul 6, 2021
@narrieta narrieta deleted the etag branch July 6, 2021 17:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants