Skip to content

Commit 4f8ab3f

Browse files
iveskinschris-rock
authored andcommitted
allow yum to run as non-root user. (#20)
* Update linux_updates.rb run yum-cli via sudo, so can work with non-root user * Update linux_updates.rb set cache dir for yum. Default cache dir needs root access. setting the cache dir to tmp to allow non-root users to run this test. This way we don't need to allow ssh to the root account, or enable python in sudoers. * Update linux_updates.rb remove unneeded 'sudo'
1 parent a4f0309 commit 4f8ab3f

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

libraries/linux_updates.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ def packages
199199
def updates
200200
rhel_updates = <<-PRINT_JSON
201201
#!/bin/sh
202-
python -c 'import sys; sys.path.insert(0, "/usr/share/yum-cli"); import cli; list = cli.YumBaseCli().returnPkgLists(["updates"]);res = ["{\\"name\\":\\""+x.name+"\\", \\"version\\":\\""+x.version+"-"+x.release+"\\",\\"arch\\":\\""+x.arch+"\\",\\"repository\\":\\""+x.repo.id+"\\"}" for x in list.updates]; print "{\\"available\\":["+",".join(res)+"]}"'
202+
python -c 'import sys; sys.path.insert(0, "/usr/share/yum-cli"); import cli; ybc = cli.YumBaseCli(); ybc.setCacheDir("/tmp"); list = ybc.returnPkgLists(["updates"]);res = ["{\\"name\\":\\""+x.name+"\\", \\"version\\":\\""+x.version+"-"+x.release+"\\",\\"arch\\":\\""+x.arch+"\\",\\"repository\\":\\""+x.repo.id+"\\"}" for x in list.updates]; print "{\\"available\\":["+",".join(res)+"]}"'
203203
PRINT_JSON
204204
cmd = @inspec.bash(rhel_updates)
205205
unless cmd.exit_status == 0

0 commit comments

Comments
 (0)