[merged] Cleanup atomic command minor fixes#521
[merged] Cleanup atomic command minor fixes#521rhatdan wants to merge 1 commit intoprojectatomic:masterfrom
Conversation
Atomic/atomic.py
Outdated
|
|
||
| if hasattr(self.args, 'opt1') and self.args.opt1: | ||
| if self.args.get('opt1', False): | ||
| os.environ['OPT1'] = self.args.opt1 |
There was a problem hiding this comment.
Hmm...not related to this change but this looks a bit dangerous - we're mutating the current process' environment, which means that conceptually we can only do one action at a time. If we ever supported running multiple containers in one go, this would have to change.
It's normally better regardless to prepare the environment for the child process rather than mutating self's. Anyways, not a blocker for this patch, just noting.
There was a problem hiding this comment.
Yes good point, I would love to drop most of the opt handling, since we are now passing the environment from the atomic command into the containers runtime.
|
Looks like the first commit was written by |
7ceb02c to
b338f26
Compare
|
@cgwalters Fixed root->dwalsh |
Atomic/atomic.py
Outdated
| def cmd_env(self): | ||
| os.environ['NAME'] = self.name or "" | ||
| os.environ['IMAGE'] = self.image or "" | ||
| newenv = os.environ |
There was a problem hiding this comment.
I think you need newenv = dict(os.environ) or so.
e47bd95 to
aad1219
Compare
22b89e6 to
0cba782
Compare
|
The reason for tests failing is the That So all |
|
@cgwalters What do you think? We could change the environment expand and then change it back? |
Or reimplement By the way, why do you want to get rid of the |
dd8d3f5 to
72066b9
Compare
|
How about this far simpler fix, Also @adelton does this fix your other problem where we were substituting twice. |
|
@adelton Regarding mutating |
|
How many threads does a typical |
|
1 |
|
I don't have enough Python foo to say if it should be In any case, this patch now does not get rid of the modification of |
|
I think we can modify it, as long as we are about to exec. Modifying it permanently or running it multiple times can cause problems. |
|
Maybe 1 thread right now, but as soon as e.g. we port to |
|
I guess it would be best if somone took os.path.expandvars and made it take an environment param |
|
No longer needed. |
|
Added utils.expandvars. But I am not sure if this will work properly on python2 and python3 |
|
@adelton PTAL |
|
My testing looks good for python3 and python2 and the test suite passed. |
|
☔ The latest upstream changes (presumably 683c0fa) made this pull request unmergeable. Please resolve the merge conflicts. |
Create a copy of os.environ and then modify the copy. Also add a new function expandvars to util. This function is a copy of os.path.expandvars but takes an optional parameter of the environment to expand.
|
LGTM. |
|
@cgwalters PTAL |
|
☀️ Test successful - status-atomicjenkins |
1 Remove debugging output when I mount an ostree image.
2 Cleanup cmd_env to not modify current processes os.environ