Repository: Azure/WALinuxAgent (python)

Issue:
Bug: is_current_instance_id() should be performing a case insensitive check
Newer Linux kernels, such as 4.19, present the VM unique ID as lowercase.  The commit and explanation can be found here: https://github.com/torvalds/linux/commit/712ff25450bd01366301eef81c33e865d901e7b7#diff-f2bd14bc67b5e2da67116bca971bbd0b

The current is_current_instance_id() does a direct comparison on this value from a previously known value, so this change will trip up the Azure agent if a kernel update comes down the includes this patch.


Pull request description:
Fix is_current_instance_id to work with newer kernels
<!-- DO NOT DELETE THIS TEMPLATE -->

## Description

UUID string comparison should be case-insensitive.

This fixes #1409 <!-- if any -->
<!--
Please add an informative description that covers that changes made by the pull request. 
This checklist is used to make sure that common issues in a pull request are addressed.
This will expedite the process of getting your pull request merged and avoid extra work on your part to fix issues discovered during the review process.
-->

---

### PR information
- [x] The title of the PR is clear and informative.
- [X] There are a small number of commits, each of which has an informative message. This means that previously merged commits do not appear in the history of the PR. For information on cleaning up the commits in your pull request, [see this page](https://github.com/Azure/azure-powershell/blob/master/documentation/development-docs/cleaning-up-commits.md).
- [X] Except for special cases involving multiple contributors, the PR is started from a fork of the main repository, not a branch.
- [X] If applicable, the PR references the bug/issue that it fixes in the description.
- [X] New Unit tests were added for the changes made and Travis.CI is passing.

### Quality of Code and Contribution Guidelines
- [X] I have read the [contribution guidelines](https://github.com/Azure/WALinuxAgent/blob/master/.github/CONTRIBUTING.md).

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/azure/walinuxagent/1425)
<!-- Reviewable:end -->


Patch:
diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md
index e565290d..349786b3 100644
--- a/.github/ISSUE_TEMPLATE/bug_report.md
+++ b/.github/ISSUE_TEMPLATE/bug_report.md
@@ -3,7 +3,7 @@ name: Bug report
 about: Create a report to help us improve
 title: "[BUG]"
 labels: triage
-assignees: narrieta, pgombar, vrdmr
+assignees: narrieta, pgombar, vrdmr, roiyz-msft
 
 ---
 
diff --git a/azurelinuxagent/common/osutil/default.py b/azurelinuxagent/common/osutil/default.py
index cb4986cf..189d8fe8 100644
--- a/azurelinuxagent/common/osutil/default.py
+++ b/azurelinuxagent/common/osutil/default.py
@@ -291,8 +291,10 @@ class DefaultOSUtil(object):
         may have been persisted using the incorrect byte ordering.
         '''
         id_this = self.get_instance_id()
-        return id_that == id_this or \
-            id_that == self._correct_instance_id(id_this)
+        logger.verbose("current instance id: {0}".format(id_this))
+        logger.verbose(" former instance id: {0}".format(id_that))
+        return id_this.lower() == id_that.lower() or \
+            id_this.lower() == self._correct_instance_id(id_that).lower()
 
     @staticmethod
     def is_cgroups_supported():


Test patch:
diff --git a/tests/common/osutil/test_default.py b/tests/common/osutil/test_default.py
index 0b7690e5..6a2b7a77 100644
--- a/tests/common/osutil/test_default.py
+++ b/tests/common/osutil/test_default.py
@@ -506,6 +506,9 @@ Match host 192.168.1.2\n\
         self.assertEqual(
             "D0DF4C54-4ECB-4A4B-9954-5BDF3ED5C3B8",
             util._correct_instance_id("544CDFD0-CB4E-4B4A-9954-5BDF3ED5C3B8"))
+        self.assertEqual(
+            "d0df4c54-4ecb-4a4b-9954-5bdf3ed5c3b8",
+            util._correct_instance_id("544cdfd0-cb4e-4b4a-9954-5bdf3ed5c3b8"))
 
     @patch('os.path.isfile', return_value=True)
     @patch('azurelinuxagent.common.utils.fileutil.read_file',
@@ -562,6 +565,10 @@ Match host 192.168.1.2\n\
     def test_is_current_instance_id_from_file(self, mock_read, mock_isfile):
         util = osutil.DefaultOSUtil()
 
+        mock_read.return_value = "11111111-2222-3333-4444-556677889900"
+        self.assertFalse(util.is_current_instance_id(
+            "B9F3C233-9913-9F42-8EB3-BA656DF32502"))
+
         mock_read.return_value = "B9F3C233-9913-9F42-8EB3-BA656DF32502"
         self.assertTrue(util.is_current_instance_id(
             "B9F3C233-9913-9F42-8EB3-BA656DF32502"))
@@ -570,6 +577,14 @@ Match host 192.168.1.2\n\
         self.assertTrue(util.is_current_instance_id(
             "B9F3C233-9913-9F42-8EB3-BA656DF32502"))
 
+        mock_read.return_value = "b9f3c233-9913-9f42-8eb3-ba656df32502"
+        self.assertTrue(util.is_current_instance_id(
+            "B9F3C233-9913-9F42-8EB3-BA656DF32502"))
+
+        mock_read.return_value = "33c2f3b9-1399-429f-8eb3-ba656df32502"
+        self.assertTrue(util.is_current_instance_id(
+            "B9F3C233-9913-9F42-8EB3-BA656DF32502"))
+
     @patch('os.path.isfile', return_value=False)
     @patch('azurelinuxagent.common.utils.shellutil.run_get_output')
     def test_is_current_instance_id_from_dmidecode(self, mock_shell, mock_isfile):