Skip to content

Conversation

oskarnrk
Copy link

refs #1045

The hook can be implemented in multiple ways. For example:

Add to run.php

$this->provideHook('Icingadb/CustomVarsRetriever', 'ExampleCustomVarsRetriever');

ExampleCustomVarsRetriever.php

<?php

namespace Icinga\Module\Icingadb\ProvidedHook;

use Icinga\Module\Icingadb\Hook\CustomVarsRetrieverHook;
use ipl\Orm\Model;

class ExampleCustomVarsRetriever extends CustomVarsRetrieverHook
{
    public function retrieveCustomVars(Model $model): array
    {
        switch ($model->getTableName()) {
            case 'host':
                return ['host.vars.hostfoo', 'host.vars.hostbar'];
            case 'service':
                return ['service.vars.servicefoo', 'service.vars.servicebar'];
            default:
                return [];
        }
    }
}

Some implementation suggestions could be:

  • retrieve the custom vars and filter letting pass only the ones that actually exist
  • provide multiple hooks to implement different logic for a specific model (it's given as input)
  • save the wanted custom variables in a config.ini file and retrieve them from it

Copy link

cla-bot bot commented Aug 20, 2024

Thank you for your pull request and welcome to our community. We could not parse the GitHub identity of the following contributors: Oscar Zambotti.
This is most likely caused by a git client misconfiguration; please make sure to:

  1. check if your git client is configured with an email to sign commits git config --list | grep email
  2. If not, set it up using git config --global user.email [email protected]
  3. Make sure that the git commit email is configured in your GitHub account settings, see https://github.com/settings/emails

@oskarnrk oskarnrk closed this Aug 20, 2024
@oskarnrk oskarnrk force-pushed the feature/custom-vars-default-search-1045 branch from 5c2b7d3 to 334aaf8 Compare August 20, 2024 12:59
@cla-bot cla-bot bot added the cla/signed CLA is signed by all contributors of a PR label Aug 20, 2024
@oskarnrk oskarnrk reopened this Aug 20, 2024
Copy link

cla-bot bot commented Aug 20, 2024

Thank you for your pull request. Before we can look at it, you'll need to sign a Contributor License Agreement (CLA).

Please follow instructions at https://icinga.com/company/contributor-agreement to sign the CLA.

After that, please reply here with a comment and we'll verify.

Contributors that have not signed yet: @oskarnrk

  • If you've already signed a CLA, it's possible we don't have your GitHub username or you're using a different email address. Please contact us if you think this is the case.

  • If you signed the CLA as a corporation, your GitHub username may not have been submitted to us. Please reach out to the responsible person in your organization.

@cla-bot cla-bot bot removed the cla/signed CLA is signed by all contributors of a PR label Aug 20, 2024
@oskarnrk
Copy link
Author

Thank you for your pull request. Before we can look at it, you'll need to sign a Contributor License Agreement (CLA).

Please follow instructions at https://icinga.com/company/contributor-agreement to sign the CLA.

After that, please reply here with a comment and we'll verify.

Contributors that have not signed yet: @oskarnrk

I signed the ICLA, thanks in advance.

@oskarnrk
Copy link
Author

Is it possibile to retrigger the CLA check? Thanks

@bobapple
Copy link
Member

@cla-bot check

@cla-bot cla-bot bot added the cla/signed CLA is signed by all contributors of a PR label Oct 23, 2024
@oskarnrk
Copy link
Author

Please, is it possible to check this quite old PR? Thanks 😇

@nilmerg
Copy link
Member

nilmerg commented Feb 26, 2025

Hi, the reason why (at least for me) no-one looked at this yet, is that this isn't just a small feature. This has so many other parts which might be affected, that I don't want to introduce a half baked solution. (Besides that a new hook also requires us to cover support for it, which I cannot guarantee at all)

@oskarnrk oskarnrk closed this Aug 22, 2025
@oskarnrk oskarnrk force-pushed the feature/custom-vars-default-search-1045 branch from 1adf706 to fa23e86 Compare August 22, 2025 10:03
@oskarnrk oskarnrk reopened this Aug 22, 2025
…dated ObjectSuggestions and Controller classes to utilize the new hook for enhanced search functionality
@oskarnrk oskarnrk force-pushed the feature/custom-vars-default-search-1045 branch from 276781c to 02e6fb0 Compare August 22, 2025 12:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla/signed CLA is signed by all contributors of a PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants