Exemplo n.º 1
0
    def get_one(self, setting_name):
        """Retrieve information about the given bios setting.

        :param setting_name: Logical name of the setting to retrieve.
        """
        api_utils.check_policy('baremetal:node:bios:get')

        node = api_utils.get_rpc_node(self.node_ident)
        try:
            setting = objects.BIOSSetting.get(api.request.context, node.id,
                                              setting_name)
        except exception.BIOSSettingNotFound:
            raise exception.BIOSSettingNotFound(node=node.uuid,
                                                name=setting_name)

        return {setting_name: convert_with_links(setting, node.uuid)}
Exemplo n.º 2
0
    def get_one(self, setting_name):
        """Retrieve information about the given bios setting.

        :param setting_name: Logical name of the setting to retrieve.
        """
        cdict = pecan.request.context.to_policy_values()
        policy.authorize('baremetal:node:bios:get', cdict, cdict)

        node = api_utils.get_rpc_node(self.node_ident)
        try:
            setting = objects.BIOSSetting.get(pecan.request.context, node.id,
                                              setting_name)
        except exception.BIOSSettingNotFound:
            raise exception.BIOSSettingNotFound(node=node.uuid,
                                                name=setting_name)

        return {
            setting_name: BIOSSetting.convert_with_links(setting, node.uuid)
        }
Exemplo n.º 3
0
    def get_one(self, setting_name):
        """Retrieve information about the given bios setting.

        :param setting_name: Logical name of the setting to retrieve.
        """
        node = api_utils.check_node_policy_and_retrieve(
            'baremetal:node:bios:get', self.node_ident)

        try:
            setting = objects.BIOSSetting.get(api.request.context, node.id,
                                              setting_name)
        except exception.BIOSSettingNotFound:
            raise exception.BIOSSettingNotFound(node=node.uuid,
                                                name=setting_name)

        # Return fields based on version
        if api_utils.allow_query_bios():
            fields = _DEFAULT_FIELDS_WITH_REGISTRY
        else:
            fields = _DEFAULT_RETURN_FIELDS

        return {setting_name: convert_with_links(setting, node.uuid,
                fields=fields)}