示例#1
0
    def _detect_metadata_protocol(self):
        protocol = MetadataProtocol()
        protocol.detect()

        #Only allow root access METADATA_ENDPOINT
        self.osutil.set_admin_access_to_ip(METADATA_ENDPOINT)

        self.save_protocol("MetadataProtocol")

        return protocol
示例#2
0
    def _test_getters(self, test_data, mock_restutil ,_):
        mock_restutil.http_get.side_effect = test_data.mock_http_get

        protocol = MetadataProtocol()
        protocol.detect()
        protocol.get_vminfo()
        protocol.get_certs()
        ext_handlers, etag = protocol.get_ext_handlers()
        for ext_handler in ext_handlers.extHandlers:
            protocol.get_ext_handler_pkgs(ext_handler)
示例#3
0
    def _detect_metadata_protocol(self):
        protocol = MetadataProtocol()
        protocol.detect()
        
        #Only allow root access METADATA_ENDPOINT
        self.osutil.set_admin_access_to_ip(METADATA_ENDPOINT)
        
        self.save_protocol("MetadataProtocol")

        return protocol
    def _get_protocol(self):
        """
        Get protocol instance based on previous detecting result.
        """
        protocol_file_path = self._get_protocol_file_path()
        if not os.path.isfile(protocol_file_path):
            raise ProtocolNotFoundError("No protocol found")

        protocol_name = fileutil.read_file(protocol_file_path)
        if protocol_name == prots.WireProtocol:
            endpoint = self._get_wireserver_endpoint()
            return WireProtocol(endpoint)
        elif protocol_name == prots.MetadataProtocol:
            return MetadataProtocol()
        else:
            raise ProtocolNotFoundError(("Unknown protocol: {0}"
                                         "").format(protocol_name))
示例#5
0
    def _get_protocol(self):
        """
        Get protocol instance based on previous detecting result.
        """
        protocol_file_path = os.path.join(conf.get_lib_dir(),
                                          PROTOCOL_FILE_NAME)
        if not os.path.isfile(protocol_file_path):
            raise ProtocolNotFoundError("No protocol found")

        protocol_name = fileutil.read_file(protocol_file_path)
        if protocol_name == "WireProtocol":
            endpoint = self._get_wireserver_endpoint()
            return WireProtocol(endpoint)
        elif protocol_name == "MetadataProtocol":
            return MetadataProtocol()
        else:
            raise ProtocolNotFoundError(("Unknown protocol: {0}"
                                         "").format(protocol_name))
示例#6
0
 def _detect_metadata_protocol(self):
     protocol = MetadataProtocol()
     protocol.detect()
     self.save_protocol("MetadataProtocol")
     return protocol
示例#7
0
 def _detect_metadata_protocol(self):
     protocol = MetadataProtocol()
     protocol.detect()
     self.save_protocol("MetadataProtocol")
     return protocol
 def _detect_metadata_protocol(self):
     protocol = MetadataProtocol()
     protocol.detect()
     return protocol
示例#9
0
 def _detect_metadata_protocol(self):
     protocol = MetadataProtocol()
     protocol.detect()
     return protocol
示例#10
0
    def _test_getters(self, test_data, mock_restutil, _):
        mock_restutil.http_get.side_effect = test_data.mock_http_get

        protocol = MetadataProtocol()
        protocol.detect()
        protocol.get_vminfo()
        protocol.get_certs()
        ext_handlers, etag = protocol.get_ext_handlers()
        for ext_handler in ext_handlers.extHandlers:
            protocol.get_ext_handler_pkgs(ext_handler)