(self, registry_url, index_url=None,
                        imagerepo=None, http_proxy=None)
return True
Select docker respository
Select docker respository
Select docker respository
def _set_repository(self, registry_url, index_url=None,
                        imagerepo=None, http_proxy=None):
        """Select docker respository"""
        transport = "https:"
        if http_proxy:
            self.dockerioapi.set_proxy(http_proxy)

        if registry_url:
            if "://" not in registry_url:
                registry_url = "https://" + registry_url
            self.dockerioapi.set_registry(registry_url)
            if not index_url:
                self.dockerioapi.set_index("")

        if index_url:
            if "://" not in index_url:
                index_url = "https://" + index_url
            self.dockerioapi.set_index(index_url)
            if not registry_url:
                self.dockerioapi.set_registry("")

        if not (registry_url or index_url):
            try:
                if "://" in imagerepo:
                    (transport, dummy, hostname) = imagerepo.split('/')[:3]
                else:
                    (hostname, dummy) = imagerepo.split('/')[:2]
            except (ValueError, IndexError, TypeError):
                return False
            if "." in hostname:
                try:
                    self.dockerioapi.set_registry( \
                            Config.conf['docker_registries'][hostname][0])
                    self.dockerioapi.set_index( \
                            Config.conf['docker_registries'][hostname][1])
                except (KeyError, NameError, TypeError):
                    self.dockerioapi.set_registry(transport + "//" + hostname)
                    self.dockerioapi.set_index(transport + "//" + hostname)

        return True
def _set_repository ( self , registry_url , index_url = None , imagerepo = None , http_proxy = None ) : transport = "https:" if http_proxy : self . dockerioapi . set_proxy ( http_proxy ) if registry_url : if "://" not in registry_url : registry_url = "https://" + registry_url self . dockerioapi . set_registry ( registry_url ) if not index_url : self . dockerioapi . set_index ( "" ) if index_url : if "://" not in index_url : index_url = "https://" + index_url self . dockerioapi . set_index ( index_url ) if not registry_url : self . dockerioapi . set_registry ( "" ) if not ( registry_url or index_url ) : try : if "://" in imagerepo : ( transport , dummy , hostname ) = imagerepo . split ( '/' ) [ : 3 ] else : ( hostname , dummy ) = imagerepo . split ( '/' ) [ : 2 ] except ( ValueError , IndexError , TypeError ) : return False if "." in hostname : try : self . dockerioapi . set_registry ( Config . conf [ 'docker_registries' ] [ hostname ] [ 0 ] ) self . dockerioapi . set_index ( Config . conf [ 'docker_registries' ] [ hostname ] [ 1 ] ) except ( KeyError , NameError , TypeError ) : self . dockerioapi . set_registry ( transport + "//" + hostname ) self . dockerioapi . set_index ( transport + "//" + hostname ) return True