-
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
Implementation of new conf flag AutoUpdate.UpdateToLatestVersion support #3027
Changes from 1 commit
adb897c
d214aa5
8982384
fd34c0c
68ac618
4b94769
5c0f4d2
5261a63
6d6ccd5
41fbdc3
b526bda
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -475,8 +475,8 @@ def get_autoupdate_gafamily(conf=__conf__): | |
return conf.get("AutoUpdate.GAFamily", "Prod") | ||
|
||
|
||
def get_autoupdate_enabled(conf=__conf__): | ||
return conf.get_switch("AutoUpdate.Enabled", True) | ||
def get_autoupdate_enabled(conf=__conf__, default=True): | ||
return conf.get_switch("AutoUpdate.Enabled", default) | ||
|
||
|
||
def get_autoupdate_frequency(conf=__conf__): | ||
|
@@ -507,14 +507,15 @@ def get_auto_update_to_latest_version(conf=__conf__): | |
""" | ||
If set to True, agent will update to the latest version | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we should add unit tests that codify these rules: use all combinations of y/n/absent for both flags and check the return value of UpdateToLatestVersion There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. addressed |
||
NOTE: | ||
when turned on, both AutoEnabled.Enabled and UpdateToLatestVersion same meaning: update to latest version | ||
when turned off, AutoEnabled.Enabled: reverts to pre-installed agent, UpdateToLatestVersion: uses latest version installed on the vm | ||
Since we are deprecating AutoEnabled.Enabled, we need to honor if existing flag explicitly set to 'n' for backward compatibility. | ||
""" | ||
auto_update_enabled = get_autoupdate_enabled() | ||
if not auto_update_enabled: | ||
return auto_update_enabled | ||
return conf.get_switch("AutoUpdate.UpdateToLatestVersion", True) | ||
when both turned on, both AutoUpdate.Enabled and AutoUpdate.UpdateToLatestVersion same meaning: update to latest version | ||
when turned off, AutoUpdate.Enabled: reverts to pre-installed agent, AutoUpdate.UpdateToLatestVersion: uses latest version already installed on the vm and does not download new agents | ||
Even we are deprecating AutoUpdate.Enabled, we still need to support if users explicitly setting it instead new flag. | ||
If AutoUpdate.UpdateToLatestVersion is present, it overrides any value set for AutoUpdate.Enabled (if present). | ||
If AutoUpdate.Enabled is present and set to 'n', we adhere to AutoUpdate.Enabled flag's behavior | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same comment here as other PR, lines 513 and 514 seem to contradict each other to me |
||
if both not present, we default to True. | ||
""" | ||
default = get_autoupdate_enabled() | ||
return conf.get_switch("AutoUpdate.UpdateToLatestVersion", default) | ||
|
||
|
||
def get_cgroup_check_period(conf=__conf__): | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -63,6 +63,7 @@ class TestConf(AgentTestCase): | |
"OS.CheckRdmaDriver": False, | ||
"AutoUpdate.Enabled": True, | ||
"AutoUpdate.GAFamily": "Prod", | ||
"AutoUpdate.UpdateToLatestVersion": False, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. default should be true |
||
"EnableOverProvisioning": True, | ||
"OS.AllowHTTP": False, | ||
"OS.EnableFirewall": False | ||
|
@@ -144,3 +145,6 @@ def test_write_agent_disabled(self): | |
|
||
def test_get_extensions_enabled(self): | ||
self.assertTrue(conf.get_extensions_enabled(self.conf)) | ||
|
||
def test_get_get_auto_update_to_latest_version(self): | ||
self.assertFalse(conf.get_auto_update_to_latest_version(self.conf)) |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,7 +28,7 @@ | |
EXPECTED_CONFIGURATION = \ | ||
"""AutoUpdate.Enabled = True | ||
AutoUpdate.GAFamily = Prod | ||
AutoUpdate.UpdateToLatestVersion = True | ||
AutoUpdate.UpdateToLatestVersion = False | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. default should be true |
||
Autoupdate.Frequency = 3600 | ||
DVD.MountPoint = /mnt/cdrom/secure | ||
Debug.AgentCpuQuota = 50 | ||
|
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.
callers of get_autoupdate_enabled should not be able to override the default.
the conf module is responsible for defining the defaults