mirror of
https://github.com/projectatomic/atomic.git
synced 2026-02-06 21:45:24 +01:00
atomic_dbus: fix VulnerableInfo method
As of ef984ed, atomic.get_all_vulnerable_info() sometimes returns a JSON
object instead of a string.
Make it always return an object and amend its documentation.
Closes: #817
Approved by: baude
This commit is contained in:
committed by
Atomic Bot
parent
18863140ff
commit
dd182c19cd
@@ -544,13 +544,12 @@ class Atomic(object):
|
||||
|
||||
def get_all_vulnerable_info(self):
|
||||
"""
|
||||
Will simply read and return the entire /var/lib/atomic/scan_summary.json
|
||||
as a JSON string so it can then be parsed appropriately.
|
||||
Read and parse the /var/lib/atomic/scan_summary.json object.
|
||||
"""
|
||||
try:
|
||||
return json.loads(open(os.path.join(self.results, "scan_summary.json"), "r").read())
|
||||
except IOError:
|
||||
return "{}"
|
||||
except (IOError, ValueError):
|
||||
return {}
|
||||
|
||||
|
||||
def get_vulnerable_ids(self):
|
||||
|
||||
@@ -272,7 +272,7 @@ class atomic_dbus(slip.dbus.service.Object):
|
||||
def VulnerableInfo(self):
|
||||
args = self.Args()
|
||||
self.atomic.set_args(args)
|
||||
return self.atomic.get_all_vulnerable_info()
|
||||
return json.dumps(self.atomic.get_all_vulnerable_info())
|
||||
|
||||
# atomic install section
|
||||
# The Install method will install the specified image
|
||||
|
||||
Reference in New Issue
Block a user