Skip to content

Instantly share code, notes, and snippets.

@baude
Created August 11, 2015 15:41
Show Gist options
  • Select an option

  • Save baude/a29f02a7ba97004069df to your computer and use it in GitHub Desktop.

Select an option

Save baude/a29f02a7ba97004069df to your computer and use it in GitHub Desktop.
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