Merge ~chad.smith/cloud-init:fix/opennebula-exclude-epochseconds into cloud-init:master

Proposed by Chad Smith
Status: Merged
Approved by: Chad Smith
Approved revision: ed4e35e2965e67d14d5f814ead85eb2e69f49ceb
Merge reported by: Server Team CI bot
Merged at revision: not available
Proposed branch: ~chad.smith/cloud-init:fix/opennebula-exclude-epochseconds
Merge into: cloud-init:master
Diff against target: 15 lines (+3/-1)
1 file modified
cloudinit/sources/DataSourceOpenNebula.py (+3/-1)
Reviewer Review Type Date Requested Status
Ryan Harper Approve
Server Team CI bot continuous-integration Approve
Review via email: mp+362345@code.launchpad.net

Commit message

opennebula: also exclude epochseconds from changed environment vars

In addition to EPOCHREALTIME there is also an EPOCHSECONDS environment
variable that OpenNebula needs to exclude as it is expected to change.
This commit supplements the other exclusion in commit
d1a2fe7307e9cf2251d1f9a666c12d71d3f522d6.

Without this fix, unittests will intermittently fail if
parse_shell_config is run across a timing boundary where the
EPOCHSECONDS changes mid-test.

LP: #1813641

To post a comment you must log in.
Revision history for this message
Ryan Harper (raharper) wrote :

Newer bash (5.0) has these new variables, BASH_ARGV0, EPOCHSECONDS, and EPOCHREALTIME.

I don't think that the datasource invokes bash differently, nor do I think the config they source would be setting it; however; it is mutable, so maybe we want to also exclude that as well?

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

PASSED: Continuous integration, rev:ed4e35e2965e67d14d5f814ead85eb2e69f49ceb
https://jenkins.ubuntu.com/server/job/cloud-init-ci/547/
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/547/rebuild

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

I'll defer to your thoughts on this; so approving whether you add that to the excluded list or leave it as it is.

review: Approve
Revision history for this message
Chad Smith (chad.smith) wrote :

Thanks Ryan. As you suggest, while it's true that bash surfaces ARGV0, cloud-init's calling of that utility doesn't change across invocations, so we won't get affected by BASH_ARGV0 changing. Will leave as is.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/cloudinit/sources/DataSourceOpenNebula.py b/cloudinit/sources/DataSourceOpenNebula.py
2index 6e1d04b..02c9a7b 100644
3--- a/cloudinit/sources/DataSourceOpenNebula.py
4+++ b/cloudinit/sources/DataSourceOpenNebula.py
5@@ -337,7 +337,9 @@ def parse_shell_config(content, keylist=None, bash=None, asuser=None,
6 (output, _error) = util.subp(cmd, data=bcmd)
7
8 # exclude vars in bash that change on their own or that we used
9- excluded = ("EPOCHREALTIME", "RANDOM", "LINENO", "SECONDS", "_", "__v")
10+ excluded = (
11+ "EPOCHREALTIME", "EPOCHSECONDS", "RANDOM", "LINENO", "SECONDS", "_",
12+ "__v")
13 preset = {}
14 ret = {}
15 target = None

Subscribers

People subscribed via source and target branches