-
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
Upgrade/Downgrade agent if Requested Version available #2479
Conversation
# Conflicts: # azurelinuxagent/ga/update.py
@@ -298,6 +298,3 @@ def set_goal_state_agent(): | |||
|
|||
GOAL_STATE_AGENT_VERSION = set_goal_state_agent() | |||
|
|||
|
|||
def is_current_agent_installed(): |
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 code logic was not being used anymore, so removed it
@@ -815,17 +853,6 @@ def _is_orphaned(self): | |||
|
|||
return fileutil.read_file(conf.get_agent_pid_file_path()) != ustr(parent_pid) | |||
|
|||
def _is_version_eligible(self, version): |
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 function was only being used in 1 place (during auto-update) and due to the condition below, it was always True (if version == CURRENT_VERSION and is_current_agent_installed(): return True
). Since it was not adding much value to the code, removed it
Codecov Report
@@ Coverage Diff @@
## develop #2479 +/- ##
===========================================
+ Coverage 71.96% 72.01% +0.05%
===========================================
Files 101 101
Lines 15064 15100 +36
Branches 2394 2399 +5
===========================================
+ Hits 10841 10875 +34
Misses 3737 3737
- Partials 486 488 +2
Continue to review full report at Codecov.
|
@@ -1100,34 +1101,6 @@ def test_is_orphaned_returns_true_if_parent_does_not_exist(self): | |||
with patch('os.getppid', return_value=42): | |||
self.assertTrue(self.update_handler._is_orphaned) | |||
|
|||
def test_is_version_available(self): |
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.
Removed the test cases for the functionality that was removed
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.
submitting a few comments for now... still reviewing the code
# (unless the CURRENT_VERSION == daemon version, but since we don't support downgrading | ||
# below daemon version, we will never reach this code path if that's the scenario) | ||
current_agent = next(agent for agent in self.agents if agent.version == CURRENT_VERSION) | ||
current_agent.mark_failure(is_fatal=True) |
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 add a log statement explaining why this is being blacklisted? (and not mentioning "blacklisting", which an implementation thing, but rather that that specific version will not be executed because blah blah)
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.
Done (though I did mention the word blacklisting
because I feel its pretty self explanatory (and makes it easier to explain) even to folks outside our dev group who read the logs for debugging.
current_agent = next(agent for agent in self.agents if agent.version == CURRENT_VERSION) | ||
current_agent.mark_failure(is_fatal=True) | ||
except StopIteration: | ||
logger.warn( |
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.
do we need this warning? this is the current version not finding itself, right? i think that would happen only if the current version is running as the daemon
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 think that would happen only if the current version is running as the daemon
This scenario is already handled separately. If that is the case, we would not hit this code path. That is the primary reason for this warning, as that situation should not happen ever
@@ -923,59 +967,78 @@ def _check_and_download_agent_if_upgrade_available(self, protocol, base_version= | |||
if not conf.get_autoupdate_enabled(): | |||
return False | |||
|
|||
def report_error(msg_, version=CURRENT_VERSION): | |||
def report_error(msg_, version_=CURRENT_VERSION, op=WALAEventOperation.Download): |
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.
Let's not default this WALAEventOperation.Download, but make it an explicit parameter. There are some usages where the default is being used to report issues not related do download
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.
Which usage exactly did you see where we're reporting it as a download failure but its not one? This helper function is mainly to log those errors inside the _download_agent_if_upgrade_available
function and instead of one call to it, all other calls for this function are Download
errors, that's why I defaulted to that operation to make the code cleaner
Description
This PR contains the next set of changes for GA Versioning. Certain key points of this PR -
Issue #
PR information
Quality of Code and Contribution Guidelines