Skip to content

Commit 0ae27ba

Browse files
authored
Merge pull request #200 from singularityhub/add/sudo-control
remove -E from sudo default
2 parents eba357c + 9aa80c5 commit 0ae27ba

File tree

4 files changed

+12
-4
lines changed

4 files changed

+12
-4
lines changed

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ The client here will eventually be released as "spython" (and eventually to
1717
singularity on pypi), and the versions here will coincide with these releases.
1818

1919
## [master](https://github.com/singularityhub/singularity-cli/tree/master)
20-
- WORKDIR should create container for Singularity converter (0.0.12)
20+
- sudo `-E` flag should not be provided by default (0.2.13)
21+
- WORKDIR should create container for Singularity converter (0.2.12)
2122
- support for background process with client run (0.2.11)
2223
- parser bugfixes, arg from Docker not properly parsed (0.2.1)
2324
- version checks removed to support Singularity 3.x and above (0.2.0)

docs/pages/commands.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,16 @@ toc: false
77
---
88

99
# Python API
10+
1011
This commands section primarily focuses on using Singularity Python from within Python and then in an interactive shell (for testing). We will first discuss the Python API, meaning functions that you can use in python to work with Singularity images or instances. Python is strong in the world of scientific programming, and so if you are reading these notes it's likely that you want to integrate Singularity containers into your Python applications. We wrote you a client to do that! Please select the type of command you are interested in below to continue!
1112

1213
- [Images](/singularity-cli/commands-images): base API to interact with containers:
1314
- [Instances](/singularity-cli/commands-instances): interact with container instances.
1415
- [OCI](/singularity-cli/commands-oci): interact with the OCI command group (3.1.0 and up)
1516

17+
Note that for any command that allows specifying `sudo`, you can provide additional options to sudo
18+
(e.g., `-E` to preserve the environment) via `sudo_options`.
19+
1620
<hr>
1721

1822
<div>

spython/utils/terminal.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,15 @@
2525

2626

2727
def _process_sudo_cmd(cmd, sudo, sudo_options):
28+
"""
29+
Process the sudo command and honor adding environment (or not)
30+
"""
2831
if sudo and sudo_options is not None:
2932
if isinstance(sudo_options, str):
3033
sudo_options = shlex.split(sudo_options)
31-
cmd = ["sudo", "-E"] + sudo_options + cmd
34+
cmd = ["sudo"] + sudo_options + cmd
3235
elif sudo:
33-
cmd = ["sudo", "-E"] + cmd
36+
cmd = ["sudo"] + cmd
3437
return [x for x in cmd if x]
3538

3639

spython/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
# with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
66

77

8-
__version__ = "0.2.12"
8+
__version__ = "0.2.13"
99
AUTHOR = "Vanessa Sochat"
1010
AUTHOR_EMAIL = "[email protected]"
1111
NAME = "spython"

0 commit comments

Comments
 (0)