docker-check-update: convert to python 3 and juggle output
This commit is contained in:
parent
077d74d9ca
commit
38243e7897
1 changed files with 9 additions and 6 deletions
|
@ -1,4 +1,4 @@
|
|||
#!/usr/bin/python
|
||||
#!/usr/bin/python3
|
||||
"""Check Docker images for security/distro updates. Assumes DNF."""
|
||||
|
||||
from __future__ import division, print_function
|
||||
|
@ -16,9 +16,12 @@ for container in c.containers():
|
|||
print('Image: {} '.format(image_id))
|
||||
|
||||
# Not using the API here for simplicity (for now)
|
||||
subprocess.call(['docker', 'run', '-t', '--rm',
|
||||
image_id,
|
||||
'/bin/bash', '-c',
|
||||
output = subprocess.check_output([
|
||||
'docker', 'run', '-t', '--rm',
|
||||
image_id,
|
||||
'/bin/bash', '-c',
|
||||
|
||||
'dnf -q check-update;' +
|
||||
'if [ $? == 100 ]; then echo "Updates available"; fi'])
|
||||
'dnf -q check-update;' +
|
||||
'if [ $? == 100 ]; then echo "Updates available"; fi'
|
||||
])
|
||||
print(output.decode())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue