-
Notifications
You must be signed in to change notification settings - Fork 372
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
Remove file dependency #1754
Remove file dependency #1754
Conversation
…inuxAgent into RemoveFileDependency
Codecov Report
@@ Coverage Diff @@
## develop #1754 +/- ##
==========================================
Coverage ? 68.66%
==========================================
Files ? 82
Lines ? 11708
Branches ? 1641
==========================================
Hits ? 8039
Misses ? 3320
Partials ? 349
Continue to review full report at Codecov.
|
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.
a few more comments... still reviewing
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.
a couple of comments... reviewing tests now
…dressed PR comments
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.
One file dependency should be removed; other comments are nits.
self.ext_conf = ExtensionsConfig(xml_text) | ||
return self.ext_conf | ||
raise ProtocolError("Trying to fetch Extension Conf before initialization!") | ||
return self._ext_conf | ||
|
||
def get_ext_manifest(self, ext_handler, goal_state): | ||
local_file = MANIFEST_FILE_NAME.format(ext_handler.name, goal_state.incarnation) |
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.
Update to remove file dependency?
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.
+1
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.
Sorry I didnt get what you meant. If you meant MANIFEST_FILE_NAME
this file, then this is only being used to save the local cache, its never read from.
def get_ext_manifest(self, ext_handler, goal_state):
local_file = MANIFEST_FILE_NAME.format(ext_handler.name, goal_state.incarnation)
local_file = os.path.join(conf.get_lib_dir(), local_file)
try:
xml_text = self.fetch_manifest(ext_handler.versionUris)
self.save_cache(local_file, xml_text)
return ExtensionManifest(xml_text)
except Exception as e:
raise ExtensionDownloadError("Failed to retrieve extension manifest. Error: {0}".format(ustr(e)))
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.
And this could apply for the get_gafamily_manifest
case as well.
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.
Ah sorry, the name of the method (implying a getter) and the fact that we're reading something from a file made me think this was retrieving state from a file.
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.
And this could apply for the
get_gafamily_manifest
case as well.
Yes it would, both cases its the same, its just being used to save cache only
def get_gafamily_manifest(self, vmagent_manifest, goal_state):
local_file = MANIFEST_FILE_NAME.format(vmagent_manifest.family, goal_state.incarnation)
local_file = os.path.join(conf.get_lib_dir(), local_file)
try:
xml_text = self.fetch_manifest(vmagent_manifest.versionsManifestUris)
fileutil.write_file(local_file, xml_text)
return ExtensionManifest(xml_text)
except Exception as e:
raise ProtocolError("Failed to retrieve GAFamily manifest. Error: {0}".format(ustr(e)))
self.ext_conf = ExtensionsConfig(xml_text) | ||
return self.ext_conf | ||
raise ProtocolError("Trying to fetch Extension Conf before initialization!") | ||
return self._ext_conf | ||
|
||
def get_ext_manifest(self, ext_handler, goal_state): | ||
local_file = MANIFEST_FILE_NAME.format(ext_handler.name, goal_state.incarnation) |
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.
And this could apply for the get_gafamily_manifest
case as well.
azurelinuxagent/ga/remoteaccess.py
Outdated
@@ -62,7 +62,12 @@ def run(self): | |||
if self.incarnation != current_incarnation: | |||
# something changed. Handle remote access if any. | |||
self.incarnation = current_incarnation | |||
self.remote_access = self.protocol.client.get_remote_access() | |||
try: | |||
self.remote_access = self.protocol.client.get_remote_access() |
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.
This is what we discussed in the meeting - that this code would be reverted. Correct?
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.
Nope not this code, that was the RDMA code. In this I added a log.warn incase there was a ProtocolError but reverted that change because this file in majorly empty
remote_access = RemoteAccess(xml_text) | ||
return remote_access | ||
if self._remote_access is None: | ||
raise ProtocolError("Trying to fetch Remote Access before initialization!") |
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.
seems like the previous code was returning None rather than raising
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, I was initially just setting it to None too but changed to raise a ProtocolError to keep it at par with the rest of the code. I am handling this now in the remoteaccess.py file
try:
self.remote_access = self.protocol.client.get_remote_access()
except ProtocolError:
self.remote_access = None
…nd made setters private
Description
Currently the Guest Agent relies on the filesystem to fetch cached data for the GoalState if the object is None. This behavior can lead to inconsistencies in the wire client objects as some thread might update the filesystems midway of execution of goal-state.
This PR removes the dependencies of the WireClient from the file system and keeps everything in memory. We still write to files because they help in debugging.
Issue #
PR information
Quality of Code and Contribution Guidelines
This change is