Skip to content

Commit c029ea3

Browse files
committed
Support 'args' for 'cmd'
Signed-off-by: Trey Dockendorf <tdockendorf@osc.edu>
1 parent cb5c483 commit c029ea3

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,9 @@ packages:
125125
# control command verbosity. By default, it is 'INFO'.
126126
cmds:
127127
- cmd: 'echo hello'
128+
# 'cmd' also supports 'args' that are passed to 'buildah run'
129+
- cmd: 'id user'
130+
args: ['--volume', '/var/lib/sss:/var/lib/sss:z']
128131
```
129132
130133
Then you can use this config file to build a "base" layer (make sure the `S3_ACCESS` and `S3_SECRET` environment variables are set to the S3 credentials if being used):

src/installer.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,10 @@ def install_base_commands(self, commands):
215215
logging.info(f"COMMANDS: running these commands in {self.cname}")
216216
for c in commands:
217217
logging.info(c['cmd'])
218-
args = [self.cname, '--', 'bash', '-c', c['cmd']]
218+
args = []
219+
if 'args' in c:
220+
args.extend(c['args'])
221+
args.extend([self.cname, '--', 'bash', '-c', c['cmd']])
219222
if 'loglevel' in c:
220223
if c['loglevel'].upper() == "INFO":
221224
loglevel = logging.info
@@ -239,4 +242,4 @@ def install_base_copyfiles(self, copyfiles):
239242
args.extend(o.split())
240243
logging.info(f['src'] + ' -> ' + f['dest'])
241244
args += [ self.cname, f['src'], f['dest'] ]
242-
out=cmd(["buildah","copy"] + args)
245+
out=cmd(["buildah","copy"] + args)

0 commit comments

Comments
 (0)