summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Watkins <daniel.watkins@canonical.com>2016-10-04 12:25:07 +0100
committerusd-importer <ubuntu-server@lists.ubuntu.com>2016-10-04 20:58:53 +0000
commit92dfe451f28377064e24543688a3ce00e3b9cf0e (patch)
tree6c71d1b13dd770232ca91e0957c9bd6488270e50
parentaedea9e08c54c1b0afba81e499ab1ecd4b03891a (diff)
parentb6b1cb56b856e786b3ef4f82d96bf7f7e170af77 (diff)
downloadvyos-walinuxagent-92dfe451f28377064e24543688a3ce00e3b9cf0e.tar.gz
vyos-walinuxagent-92dfe451f28377064e24543688a3ce00e3b9cf0e.zip
Import patches-applied version 2.1.5-0ubuntu4 to applied/ubuntu/yakkety-proposed
Imported using git-ubuntu import. Changelog parent: aedea9e08c54c1b0afba81e499ab1ecd4b03891a Unapplied parent: b6b1cb56b856e786b3ef4f82d96bf7f7e170af77 New changelog entries: * d/patches/fix-auto-update.patch: - This patch was provided via upstream to fix auto-update, in case users choose to enable it.
-rw-r--r--azurelinuxagent/ga/update.py15
-rw-r--r--debian/changelog8
-rw-r--r--debian/patches/fix-auto-update.patch70
-rw-r--r--debian/patches/series1
-rw-r--r--tests/ga/test_update.py10
5 files changed, 92 insertions, 12 deletions
diff --git a/azurelinuxagent/ga/update.py b/azurelinuxagent/ga/update.py
index e89608a..0541ca3 100644
--- a/azurelinuxagent/ga/update.py
+++ b/azurelinuxagent/ga/update.py
@@ -379,14 +379,13 @@ class UpdateHandler(object):
"""
Load all non-blacklisted agents currently on disk.
"""
- if len(self.agents) <= 0:
- try:
- path = os.path.join(conf.get_lib_dir(), "{0}-*".format(AGENT_NAME))
- self._set_agents([GuestAgent(path=agent_dir)
- for agent_dir in glob.iglob(path) if os.path.isdir(agent_dir)])
- self._filter_blacklisted_agents()
- except Exception as e:
- logger.warn(u"Exception occurred loading available agents: {0}", ustr(e))
+ try:
+ path = os.path.join(conf.get_lib_dir(), "{0}-*".format(AGENT_NAME))
+ self._set_agents([GuestAgent(path=agent_dir)
+ for agent_dir in glob.iglob(path) if os.path.isdir(agent_dir)])
+ self._filter_blacklisted_agents()
+ except Exception as e:
+ logger.warn(u"Exception occurred loading available agents: {0}", ustr(e))
return
def _purge_agents(self):
diff --git a/debian/changelog b/debian/changelog
index 5b1306f..ea06584 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,11 @@
+walinuxagent (2.1.5-0ubuntu4) yakkety; urgency=medium
+
+ * d/patches/fix-auto-update.patch:
+ - This patch was provided via upstream to fix auto-update, in case users
+ choose to enable it.
+
+ -- Daniel Watkins <daniel.watkins@canonical.com> Tue, 04 Oct 2016 12:25:07 +0100
+
walinuxagent (2.1.5-0ubuntu3) yakkety; urgency=medium
* debian/ephemeral-disk-warning.service: add a description
diff --git a/debian/patches/fix-auto-update.patch b/debian/patches/fix-auto-update.patch
new file mode 100644
index 0000000..e4b632a
--- /dev/null
+++ b/debian/patches/fix-auto-update.patch
@@ -0,0 +1,70 @@
+Description: Fix potential infinite loop in agent updating
+Origin: upstream, via email
+Forwarded: not-needed
+diff --git a/azurelinuxagent/ga/update.py b/azurelinuxagent/ga/update.py
+index e89608a..0541ca3 100644
+--- a/azurelinuxagent/ga/update.py
++++ b/azurelinuxagent/ga/update.py
+@@ -379,14 +379,13 @@ class UpdateHandler(object):
+ """
+ Load all non-blacklisted agents currently on disk.
+ """
+- if len(self.agents) <= 0:
+- try:
+- path = os.path.join(conf.get_lib_dir(), "{0}-*".format(AGENT_NAME))
+- self._set_agents([GuestAgent(path=agent_dir)
+- for agent_dir in glob.iglob(path) if os.path.isdir(agent_dir)])
+- self._filter_blacklisted_agents()
+- except Exception as e:
+- logger.warn(u"Exception occurred loading available agents: {0}", ustr(e))
++ try:
++ path = os.path.join(conf.get_lib_dir(), "{0}-*".format(AGENT_NAME))
++ self._set_agents([GuestAgent(path=agent_dir)
++ for agent_dir in glob.iglob(path) if os.path.isdir(agent_dir)])
++ self._filter_blacklisted_agents()
++ except Exception as e:
++ logger.warn(u"Exception occurred loading available agents: {0}", ustr(e))
+ return
+
+ def _purge_agents(self):
+diff --git a/tests/ga/test_update.py b/tests/ga/test_update.py
+index 74804fb..89fe95d 100644
+--- a/tests/ga/test_update.py
++++ b/tests/ga/test_update.py
+@@ -797,14 +797,14 @@ class TestUpdate(UpdateTestCase):
+ self.assertEqual(len(get_agents(self.tmp_dir)), len(self.update_handler.agents))
+ return
+
+- def test_load_agents_does_not_reload(self):
++ def test_load_agents_does_reload(self):
+ self.prepare_agents()
+
+ self.update_handler._load_agents()
+ agents = self.update_handler.agents
+
+ self.update_handler._load_agents()
+- self.assertEqual(agents, self.update_handler.agents)
++ self.assertNotEqual(agents, self.update_handler.agents)
+ return
+
+ def test_load_agents_sorts(self):
+@@ -945,7 +945,8 @@ class TestUpdate(UpdateTestCase):
+ self.assertEqual(0.0, latest_agent.error.last_failure)
+ self.assertEqual(0, latest_agent.error.failure_count)
+
+- self._test_run_latest(mock_child=ChildMock(return_value=1))
++ with patch('azurelinuxagent.ga.update.UpdateHandler.get_latest_agent', return_value=latest_agent):
++ self._test_run_latest(mock_child=ChildMock(return_value=1))
+
+ self.assertTrue(latest_agent.is_available)
+ self.assertNotEqual(0.0, latest_agent.error.last_failure)
+@@ -961,7 +962,8 @@ class TestUpdate(UpdateTestCase):
+ self.assertEqual(0.0, latest_agent.error.last_failure)
+ self.assertEqual(0, latest_agent.error.failure_count)
+
+- self._test_run_latest(mock_child=ChildMock(side_effect=Exception("Force blacklisting")))
++ with patch('azurelinuxagent.ga.update.UpdateHandler.get_latest_agent', return_value=latest_agent):
++ self._test_run_latest(mock_child=ChildMock(side_effect=Exception("Force blacklisting")))
+
+ self.assertFalse(latest_agent.is_available)
+ self.assertTrue(latest_agent.error.is_blacklisted)
diff --git a/debian/patches/series b/debian/patches/series
index 8c08198..bc0bd89 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -3,3 +3,4 @@ cloud-init-default-cfg.patch
disable_import_test.patch
disable_udev_overrides.patch
lp1623570-adjust-walinuxagent-service-after-and-wants.patch
+fix-auto-update.patch
diff --git a/tests/ga/test_update.py b/tests/ga/test_update.py
index 74804fb..89fe95d 100644
--- a/tests/ga/test_update.py
+++ b/tests/ga/test_update.py
@@ -797,14 +797,14 @@ class TestUpdate(UpdateTestCase):
self.assertEqual(len(get_agents(self.tmp_dir)), len(self.update_handler.agents))
return
- def test_load_agents_does_not_reload(self):
+ def test_load_agents_does_reload(self):
self.prepare_agents()
self.update_handler._load_agents()
agents = self.update_handler.agents
self.update_handler._load_agents()
- self.assertEqual(agents, self.update_handler.agents)
+ self.assertNotEqual(agents, self.update_handler.agents)
return
def test_load_agents_sorts(self):
@@ -945,7 +945,8 @@ class TestUpdate(UpdateTestCase):
self.assertEqual(0.0, latest_agent.error.last_failure)
self.assertEqual(0, latest_agent.error.failure_count)
- self._test_run_latest(mock_child=ChildMock(return_value=1))
+ with patch('azurelinuxagent.ga.update.UpdateHandler.get_latest_agent', return_value=latest_agent):
+ self._test_run_latest(mock_child=ChildMock(return_value=1))
self.assertTrue(latest_agent.is_available)
self.assertNotEqual(0.0, latest_agent.error.last_failure)
@@ -961,7 +962,8 @@ class TestUpdate(UpdateTestCase):
self.assertEqual(0.0, latest_agent.error.last_failure)
self.assertEqual(0, latest_agent.error.failure_count)
- self._test_run_latest(mock_child=ChildMock(side_effect=Exception("Force blacklisting")))
+ with patch('azurelinuxagent.ga.update.UpdateHandler.get_latest_agent', return_value=latest_agent):
+ self._test_run_latest(mock_child=ChildMock(side_effect=Exception("Force blacklisting")))
self.assertFalse(latest_agent.is_available)
self.assertTrue(latest_agent.error.is_blacklisted)