-
Notifications
You must be signed in to change notification settings - Fork 371
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
Parse and compare agent manifests #2416
Conversation
from azurelinuxagent.common.utils.textutil import parse_doc, parse_json, findall, find, findtext, getattrib, gettext, format_exception, \ | ||
is_str_none_or_whitespace, is_str_empty | ||
|
||
|
||
class ExtensionsGoalStateFromExtensionsConfig(ExtensionsGoalState): | ||
def __init__(self, incarnation, xml_text, wire_client=None): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The default values (None) for wire_client was a left over of a test I was doing during my previous PR.
Codecov Report
@@ Coverage Diff @@
## develop #2416 +/- ##
========================================
Coverage 71.64% 71.65%
========================================
Files 100 100
Lines 14631 14672 +41
Branches 2092 2097 +5
========================================
+ Hits 10483 10513 +30
- Misses 3684 3692 +8
- Partials 464 467 +3
Continue to review full report at Codecov.
|
} | ||
} | ||
] | ||
<Extensions version="1.0.0.0" goalStateIncarnation="10"><GuestAgentExtension xmlns:i="http://www.w3.org/2001/XMLSchema-instance"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I updated the test data from an actual DCR run to get the latest changes in HostGAPlugin
] | ||
} | ||
] | ||
}</RuntimeSettings> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added the extensions with protected settings to this data file and removed the -protected-settings. files. This way I do not need to update 2 sets of data files when I want to take an update of the HostGAPlugin schema.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
some minor comments, else LGTM
@@ -115,6 +119,7 @@ def compare_attribute(attribute): | |||
compare_attribute("status_upload_blob_type") | |||
compare_attribute("required_features") | |||
compare_attribute("on_hold") | |||
compare_attribute("agent_manifests") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the comparison of ext-handlers going to be done in a separate PR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, all this refactoring is affecting a lot of code and those changes need to be done gradually
azurelinuxagent/common/protocol/extensions_goal_state_from_vm_settings.py
Show resolved
Hide resolved
class VMAgentManifestUri(DataContract): | ||
def __init__(self, uri=None): | ||
self.uri = uri | ||
class VMAgentManifest(object): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the refactoring!
"extensionGoalStatesSource": "Fabric", | ||
"StatusUploadBlob": { | ||
"statusUploadBlob": { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know we handle this on our end, but is the casing not guaranteed from HostGA? I remember Rohit mentioning something about fixing this, is that not in yet?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we need to keep doing this until all the nodes in the fleet are updated with the newest HostGAPlugin (which will take a loong time, unfortunately)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
totally understand that, was just curious to know if this was being handled by HostGA or not. Like if its supposed to be handled properly by HostGA and still we're seeing discrepancy we should probably let Rohit know about it too as it might be a regression there
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At some point we should be ready to declare "version W.X.Y.Z of the HostGAPlugin is ready and all the fleet is updated"... at that point we'll add a single check for that version and remove all those workarounds/checks (case-insensitive dictionary, check for > 112, comparison of goal states, etc). Discrepancies would pop up then. Right now it is not worth checking the case of properties (I haven't seen any during my manual tests, BTW).
from azurelinuxagent.common.protocol.restapi import Extension, ExtHandler, ExtHandlerVersionUri, VMAgentManifest, \ | ||
VMAgentManifestUri, ExtensionState, ExtHandlerList, VMAgentManifestList, InVMGoalStateMetaData | ||
from azurelinuxagent.common.protocol.restapi import Extension, ExtHandler, VMAgentManifest, \ | ||
ExtensionState, ExtHandlerList, InVMGoalStateMetaData | ||
from azurelinuxagent.common.utils.textutil import parse_doc, parse_json, findall, find, findtext, getattrib, gettext, format_exception, \ | ||
is_str_none_or_whitespace, is_str_empty | ||
|
||
|
||
class ExtensionsGoalStateFromExtensionsConfig(ExtensionsGoalState): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we test for agent_manifest from extension_config like we have for vm_settings.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not sure i get your comment @nagworld9 ... the extension config stuff is existing code and has existing tests. is that what you meant?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately, the existing tests not covering agent manifests checks. I don't mind leaving it now but may be when you touch the test file again it's worthwhile to consider testing.
https://github.com/Azure/WALinuxAgent/blob/develop/tests/protocol/test_extensions_goal_state_from_extensions_config.py#L8
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, the existing code lacks some tests. retrofitting tests to that code would be costly. do feel free to add tests where you consider it worth the effort
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Parse the agent manifests in vmSettings and compare them against extensionsConfig.
In the process, I removed VMAgentManifestUri, VMAgentManifestList, ExtHandlerVersionUri, and ExtHandlerPackageUri and replaced them with simple types (strings and lists)