<s> '''<STR_LIT>''' <EOL> import os <EOL> import sys <EOL> try : <EOL> from docker import Client <EOL> except Exception : <EOL> pass <EOL> from core . service import CoreService , addservice <EOL> from core . misc . ipaddr import IPv4Prefix , IPv6Prefix <EOL> class DockerService ( CoreService ) : <EOL> '''<STR_LIT>''' <EOL> _name = "<STR_LIT>" <EOL> _group = "<STR_LIT>" <EOL> _depends = ( ) <EOL> _dirs = ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , ) <EOL> _configs = ( '<STR_LIT>' , ) <EOL> _startindex = <NUM_LIT:50> <EOL> _startup = ( '<STR_LIT>' , ) <EOL> _shutdown = ( '<STR_LIT>' , ) <EOL> _image = "<STR_LIT>" <EOL> @ classmethod <EOL> def generateconfig ( cls , node , filename , services ) : <EOL> '''<STR_LIT>''' <EOL> cfg = "<STR_LIT>" <EOL> cfg += "<STR_LIT>" <EOL> cfg += '<STR_LIT>' <EOL> cfg += '<STR_LIT>' <EOL> cfg += "<STR_LIT>" <EOL> if not cls . _image : <EOL> cfg += "<STR_LIT>" <EOL> else : <EOL> cfg += """<STR_LIT>""" % ( cls . _image , ) <EOL> return cfg <EOL> addservice ( DockerService ) <EOL> if '<STR_LIT>' in globals ( ) : <EOL> client = Client ( version = '<STR_LIT>' ) <EOL> images = client . images ( ) <EOL> del client <EOL> else : <EOL> images = [ ] <EOL> for image in images : <EOL> if u'<STR_LIT>' in image [ '<STR_LIT>' ] [ <NUM_LIT:0> ] : <EOL> continue <EOL> for repo in image [ '<STR_LIT>' ] : <EOL> if u'<STR_LIT>' not in repo : <EOL> continue <EOL> dockerid = repo . encode ( '<STR_LIT:ascii>' , '<STR_LIT:ignore>' ) . split ( '<STR_LIT::>' ) [ <NUM_LIT:0> ] <EOL> SubClass = type ( '<STR_LIT>' , ( DockerService , ) , <EOL> { '<STR_LIT>' : dockerid , '<STR_LIT>' : dockerid } ) <EOL> addservice ( SubClass ) <EOL> del images </s>
