def get_hosted_registry_insecure():
 hosted_registry_insecure = None
 if os.path.exists('/etc/sysconfig/docker'):
  try:
   ini_str = text_type(('[root]\n' + open('/etc/sysconfig/docker', 'r').read()), 'utf-8')
   ini_fp = io.StringIO(ini_str)
   config = configparser.RawConfigParser()
   config.readfp(ini_fp)
   options = config.get('root', 'OPTIONS')
   if ('insecure-registry' in options):
    hosted_registry_insecure = True
  except Exception:
   pass
 return hosted_registry_insecure

def get_hosted_registry_insecure ( ) : hosted_registry_insecure = None if os . path . exists ( '/etc/sysconfig/docker' ) : try : ini_str = text_type ( ( '[root]\n' + open ( '/etc/sysconfig/docker' , 'r' ) . read ( ) ) , 'utf-8' ) ini_fp = io . StringIO ( ini_str ) config = configparser . RawConfigParser ( ) config . readfp ( ini_fp ) options = config . get ( 'root' , 'OPTIONS' ) if ( 'insecure-registry' in options ) : hosted_registry_insecure = True except Exception : pass return hosted_registry_insecure
parses options from /etc/sysconfig/docker to determine if the registry is currently insecure .