Merge ~xiaofengw/cloud-init:xiaofengw-post-script-bug-fix into cloud-init:master

Proposed by Xiaofeng Wang
Status: Merged
Approved by: Dan Watkins
Approved revision: c7f9308e16a2978d528b7770e5a884c1d8a690c8
Merge reported by: Server Team CI bot
Merged at revision: not available
Proposed branch: ~xiaofengw/cloud-init:xiaofengw-post-script-bug-fix
Merge into: cloud-init:master
Diff against target: 29 lines (+8/-1)
2 files modified
cloudinit/sources/helpers/vmware/imc/guestcust_util.py (+1/-1)
tests/unittests/test_vmware/test_guestcust_util.py (+7/-0)
Reviewer Review Type Date Requested Status
Server Team CI bot continuous-integration Approve
Ryan Harper Approve
Review via email: mp+373122@code.launchpad.net

Commit message

guestcust_util: handle special characters in config file

Handle the special characters when reading VM Tools configure file.
For example, the key and value may contain _, - and . etc.

To post a comment you must log in.
Revision history for this message
Server Team CI bot (server-team-bot) wrote :

FAILED: Continuous integration, rev:0aac863b18d2bc4681c3ff0fd7b3626ca4093396
https://jenkins.ubuntu.com/server/job/cloud-init-ci/1167/
Executed test runs:
    SUCCESS: Checkout
    FAILED: Unit & Style Tests

Click here to trigger a rebuild:
https://jenkins.ubuntu.com/server/job/cloud-init-ci/1167//rebuild

review: Needs Fixing (continuous-integration)
Revision history for this message
Ryan Harper (raharper) wrote :

Thanks this looks good. I've pointed CI at this branch.

Revision history for this message
Ryan Harper (raharper) wrote :

The CI failure is unrelated to your changes, it was a pylint failure. We'll fix that up and resubmit the CI job.

Revision history for this message
Ryan Harper (raharper) wrote :

Hi, please rebase this branch to master, we've landed a fix for the CI failures

Revision history for this message
Server Team CI bot (server-team-bot) wrote :

FAILED: Continuous integration, rev:0aac863b18d2bc4681c3ff0fd7b3626ca4093396
https://jenkins.ubuntu.com/server/job/cloud-init-ci/1175/
Executed test runs:
    SUCCESS: Checkout
    FAILED: Unit & Style Tests

Click here to trigger a rebuild:
https://jenkins.ubuntu.com/server/job/cloud-init-ci/1175//rebuild

review: Needs Fixing (continuous-integration)
Revision history for this message
Xiaofeng Wang (xiaofengw) wrote :

> Hi, please rebase this branch to master, we've landed a fix for the CI
> failures
Hi Ryan,
I tried to rebase from master and found there is nothing to merge. Could you check? Thanks.

cc@Xiaofeng-UBUNTU1604-cloudInit:~/cloud-init-tmp/cloud-init$ git branch
* xiaofengw-post-script-bug-fix
cc@Xiaofeng-UBUNTU1604-cloudInit:~/cloud-init-tmp/cloud-init$ git remote add upstream https://git.launchpad.net/cloud-init
fatal: remote upstream already exists.
cc@Xiaofeng-UBUNTU1604-cloudInit:~/cloud-init-tmp/cloud-init$ git fetch upstream
cc@Xiaofeng-UBUNTU1604-cloudInit:~/cloud-init-tmp/cloud-init$ git rebase -i origin/master
Successfully rebased and updated refs/heads/xiaofengw-post-script-bug-fix.
cc@Xiaofeng-UBUNTU1604-cloudInit:~/cloud-init-tmp/cloud-init$ git status
On branch xiaofengw-post-script-bug-fix
Your branch is up-to-date with 'origin/xiaofengw-post-script-bug-fix'.
nothing to commit, working directory clean
cc@Xiaofeng-UBUNTU1604-cloudInit:~/cloud-init-tmp/cloud-init$

Revision history for this message
Dan Watkins (oddbloke) wrote :

I think your rebase command needs to use "upstream/master" instead of "origin/master".

Revision history for this message
Xiaofeng Wang (xiaofengw) wrote :

> I think your rebase command needs to use "upstream/master" instead of
> "origin/master".

It's the same if I use "upstream/master". I wonder if there is anyone could help me check on this branch. Do I still need to rebase? Thanks.

Revision history for this message
Server Team CI bot (server-team-bot) wrote :

PASSED: Continuous integration, rev:c7f9308e16a2978d528b7770e5a884c1d8a690c8
https://jenkins.ubuntu.com/server/job/cloud-init-ci/1187/
Executed test runs:
    SUCCESS: Checkout
    SUCCESS: Unit & Style Tests
    SUCCESS: Ubuntu LTS: Build
    SUCCESS: Ubuntu LTS: Integration
    IN_PROGRESS: Declarative: Post Actions

Click here to trigger a rebuild:
https://jenkins.ubuntu.com/server/job/cloud-init-ci/1187//rebuild

review: Approve (continuous-integration)
Revision history for this message
Ryan Harper (raharper) wrote :

Thanks for the fix!

review: Approve
Revision history for this message
Xiaofeng Wang (xiaofengw) wrote :

> Thanks for the fix!

The status is still Approve but not merged. Is there anything I could do? Thanks.

Revision history for this message
Ryan Harper (raharper) wrote :

Sorry for the delay.

Revision history for this message
Server Team CI bot (server-team-bot) wrote :

Commit message lints:
- Line #0 has 52 too many characters. Line starts with: "Handle the special characters"...

review: Needs Fixing
Revision history for this message
Server Team CI bot (server-team-bot) :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/cloudinit/sources/helpers/vmware/imc/guestcust_util.py b/cloudinit/sources/helpers/vmware/imc/guestcust_util.py
2index eb78172..3d369d0 100644
3--- a/cloudinit/sources/helpers/vmware/imc/guestcust_util.py
4+++ b/cloudinit/sources/helpers/vmware/imc/guestcust_util.py
5@@ -138,7 +138,7 @@ def get_tools_config(section, key, defaultVal):
6
7 try:
8 (outText, _) = util.subp(cmd)
9- m = re.match(r'([a-zA-Z0-9 ]+)=(.*)', outText)
10+ m = re.match(r'([^=]+)=(.*)', outText)
11 if m:
12 retValue = m.group(2).strip()
13 logger.debug("Get tools config: [%s] %s = %s",
14diff --git a/tests/unittests/test_vmware/test_guestcust_util.py b/tests/unittests/test_vmware/test_guestcust_util.py
15index b8fa994..b175a99 100644
16--- a/tests/unittests/test_vmware/test_guestcust_util.py
17+++ b/tests/unittests/test_vmware/test_guestcust_util.py
18@@ -62,4 +62,11 @@ class TestGuestCustUtil(CiTestCase):
19 get_tools_config('section', 'key', 'defaultVal'),
20 'Bar=Wark')
21
22+ # value contains specific characters
23+ with mock.patch.object(util, 'subp',
24+ return_value=('[a] b.c_d=e-f', b'')):
25+ self.assertEqual(
26+ get_tools_config('section', 'key', 'defaultVal'),
27+ 'e-f')
28+
29 # vi: ts=4 expandtab

Subscribers

People subscribed via source and target branches