<s> """<STR_LIT>""" <EOL> import logging <EOL> from gcimagebundlelib import centos <EOL> from gcimagebundlelib import fedora <EOL> from gcimagebundlelib import debian <EOL> from gcimagebundlelib import gcel <EOL> from gcimagebundlelib import opensuse <EOL> from gcimagebundlelib import rhel <EOL> from gcimagebundlelib import sle <EOL> from gcimagebundlelib import ubuntu <EOL> class UnknownPlatformException ( Exception ) : <EOL> """<STR_LIT>""" <EOL> class PlatformFactory ( object ) : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self , root = '<STR_LIT:/>' ) : <EOL> self . __root = root <EOL> self . __registry = { } <EOL> self . __platform_registry = { } <EOL> self . Register ( '<STR_LIT>' , centos . Centos ) <EOL> self . Register ( '<STR_LIT>' , fedora . Fedora ) <EOL> self . Register ( '<STR_LIT>' , debian . Debian ) <EOL> self . Register ( '<STR_LIT>' , gcel . Gcel ) <EOL> self . Register ( '<STR_LIT>' , opensuse . OpenSUSE ) <EOL> self . Register ( '<STR_LIT>' , rhel . RHEL ) <EOL> self . Register ( '<STR_LIT>' , sle . SLE ) <EOL> self . Register ( '<STR_LIT>' , ubuntu . Ubuntu ) <EOL> def Register ( self , name , klass ) : <EOL> self . __registry [ name ] = klass <EOL> def GetPlatform ( self ) : <EOL> for name in self . __registry : <EOL> if self . __registry [ name ] . IsThisPlatform ( self . __root ) : <EOL> logging . info ( '<STR_LIT>' , name ) <EOL> return self . __registry [ name ] ( ) <EOL> else : <EOL> logging . debug ( '<STR_LIT>' , name , self . __registry [ name ] ) <EOL> raise UnknownPlatformException ( '<STR_LIT>' ) </s>
