Beispiel #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
    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)
Beispiel #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))
Beispiel #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))
Beispiel #6
0
 def _detect_metadata_protocol(self):
     protocol = MetadataProtocol()
     protocol.detect()
     self.save_protocol("MetadataProtocol")
     return protocol
Beispiel #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
Beispiel #9
0
 def _detect_metadata_protocol(self):
     protocol = MetadataProtocol()
     protocol.detect()
     return protocol
Beispiel #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)