Created
August 11, 2015 15:41
-
-
Save baude/a29f02a7ba97004069df to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import dbus | |
| import dbus.service | |
| import sys | |
| import dbus | |
| import dbus.service | |
| import dbus.mainloop.glib | |
| from slip.dbus import polkit | |
| import json | |
| import collections | |
| class ImageScannerClientError(Exception): | |
| """Docker Error""" | |
| pass | |
| class Client(object): | |
| ''' The image-scanner client API ''' | |
| scan_args = ['allcontainers', 'allimages', 'images', 'logfile', 'nocache', | |
| 'number', 'onlyactive', 'reportdir', | |
| 'workdir', 'api', 'url_root', 'host', 'rest_host', 'rest_port', | |
| 'scan'] | |
| scan_tuple = collections.namedtuple('Namespace', scan_args) | |
| def __init__(self, number=2): | |
| self.num_threads = number | |
| self.bus = dbus.SystemBus() | |
| self.dbus_object = self.bus.get_object("org.atomic", | |
| "/org/atomic/scanner") | |
| @polkit.enable_proxy | |
| def test(self): | |
| foo = "hello" | |
| print self.dbus_object.test(foo, dbus_interface="org.atomic.Scanner") | |
| @polkit.enable_proxy | |
| def inspect_container(self, cid): | |
| foo = self.dbus_object.inspect_container(cid, dbus_interface="org.atomic.Scanner") | |
| print type(foo) | |
| print foo |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment