Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Unable to modify a service apply rules #2808

Closed
Yoda-BZH opened this issue Sep 26, 2023 · 2 comments
Closed

[BUG] Unable to modify a service apply rules #2808

Yoda-BZH opened this issue Sep 26, 2023 · 2 comments
Assignees
Labels
Milestone

Comments

@Yoda-BZH
Copy link

Expected Behavior

When editing a service generated by a Service Apply rules, you should be able to modify the service.

Current Behavior

The following error is generated:



Uncaught TypeError: Icinga\Module\Director\Restriction\ObjectRestriction::__construct(): Argument #2 ($auth) must be of type Icinga\Authentication\Auth, null given, called in /usr/share/icingaweb2/modules.git/director/library/Director/Web/Table/ObjectsTable.php on line 240 and defined in /usr/share/icingaweb2/modules.git/director/library/Director/Restriction/ObjectRestriction.php:22
Stack trace:
#0 /usr/share/icingaweb2/modules.git/director/library/Director/Web/Table/ObjectsTable.php(240): Icinga\Module\Director\Restriction\ObjectRestriction->__construct()
#1 /usr/share/icingaweb2/modules.git/director/library/Director/Web/Table/ObjectsTable.php(227): Icinga\Module\Director\Web\Table\ObjectsTable->loadRestrictions()
#2 /usr/share/icingaweb2/modules.git/director/library/Director/Web/Table/ObjectsTable.php(217): Icinga\Module\Director\Web\Table\ObjectsTable->getRestrictions()
#3 /usr/share/icingaweb2/modules.git/director/library/Director/Web/Table/ObjectsTable.php(340): Icinga\Module\Director\Web\Table\ObjectsTable->applyRestrictions()
#4 /usr/share/icingaweb2/modules.git/director/library/Director/Web/Table/ObjectsTableService.php(189): Icinga\Module\Director\Web\Table\ObjectsTable->prepareQuery()
#5 /usr/share/icingaweb2/modules/incubator/vendor/gipfl/icingaweb2/src/Table/ZfQueryBasedTable.php(124): Icinga\Module\Director\Web\Table\ObjectsTableService->prepareQuery()
#6 /usr/share/icingaweb2/modules/incubator/vendor/gipfl/icingaweb2/src/Table/ZfQueryBasedTable.php(60): gipfl\IcingaWeb2\Table\ZfQueryBasedTable->getQuery()
#7 /usr/share/icingaweb2/modules/incubator/vendor/gipfl/icingaweb2/src/Table/QueryBasedTable.php(66): gipfl\IcingaWeb2\Table\ZfQueryBasedTable->getPaginationAdapter()
#8 [internal function]: gipfl\IcingaWeb2\Table\QueryBasedTable->count()
#9 /usr/share/icingaweb2/modules.git/director/application/controllers/HostController.php(298): count()
#10 /usr/share/icingaweb2/library/vendor/Zend/Controller/Action.php(507): Icinga\Module\Director\Controllers\HostController->servicesroAction()
#11 /usr/share/php/Icinga/Web/Controller/Dispatcher.php(76): Zend_Controller_Action->dispatch()
#12 /usr/share/icingaweb2/library/vendor/Zend/Controller/Front.php(937): Icinga\Web\Controller\Dispatcher->dispatch()
#13 /usr/share/php/Icinga/Application/Web.php(290): Zend_Controller_Front->dispatch()
#14 /usr/share/php/Icinga/Application/webrouter.php(105): Icinga\Application\Web->dispatch()
#15 /usr/share/icingaweb2/public/index.php(4): require_once('...')
#16 {main}
thrown

#0 [internal function]: Icinga\Application\Web->Icinga\Application\{closure}()
#1 {main}

image

Possible Solution

None tested

Steps to Reproduce (for bugs)

Create a service apply rules :

apply Service for (config in host.vars.websites_443) {
    name = "Website: check " + config + ":443"
    import "template-agent"
    import "periode-60min-3x-5min"
    import "definition-http"

    assign where host.vars.websites_443
    groups = [ "websites-443" ]
    vars.http_address = "127.0.0.1"
    vars.http_hostname = config
    vars.http_port = "443"
    vars.http_sni = true
    vars.http_ssl = true
    vars.http_useragent = "custom user agent"
    vars.http_vhost = config

    import DirectorOverrideTemplate
}

template Service "definition-http" {
    import "template-agent"

    check_command = "http_"
    icon_image = "/icons/Papirus/16x16/actions/web-browser.svg"
    icon_image_alt = "http"
    groups = [ "websites" ]
}

Your Environment

  • Director version (System - About): master @ 76509bb
  • Icinga Web 2 version and modules (System - About):
    Icinga Web 2 Version | 2.11.4
    Git Commit 11453bfa92a70a44efbf7f966f5e7f27e9300a28
    PHP 8.0.30
    Git commit date 2023-01-26
    Provider: Ubuntu package from packages.icinga.com

Loaded Modules
setup : 2.11.4
director : master
icingadb : 1.0.2
incubator : 0.20.0

  • Icinga 2 version (icinga2 --version): 2.14.0-1+ubuntu22.04
  • Operating System and version: Ubuntu 22.04 LTS
  • Webserver, PHP versions: Apache, PHP8.0
@Yoda-BZH Yoda-BZH changed the title Unable to modify a service apply rules [BUG] Unable to modify a service apply rules Sep 27, 2023
@Thomas-Gelf Thomas-Gelf self-assigned this Oct 11, 2023
@Thomas-Gelf Thomas-Gelf added this to the v1.11.0 milestone Oct 11, 2023
@Thomas-Gelf
Copy link
Contributor

Related tables have no Auth objects, that's why they fail. They don't need it right now, but this may change depending on future restriction possibilities. So we should be strict about this, and require an Auth object all the times

@Thomas-Gelf
Copy link
Contributor

@Yoda-BZH: thanks for reporting this, it should now work as expected

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants