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

Editing old service in service set fails with exception #2478

Open
Tuxdiver opened this issue Feb 18, 2022 · 1 comment
Open

Editing old service in service set fails with exception #2478

Tuxdiver opened this issue Feb 18, 2022 · 1 comment

Comments

@Tuxdiver
Copy link

Expected Behavior

clicking on a service in a service set should show the edit dialog for setting parameters

Current Behavior

On services added long ago to a service set, the click on the service name produces this exception:

Uncaught Error: Call to a member function toString() on null in /usr/share/icingaweb2/modules/director/application/controllers/ServiceController.php:254
Stack trace:
#0 /usr/share/icingaweb2/modules/director/library/Director/Web/Controller/ObjectController.php(497): Icinga\Module\Director\Controllers\ServiceController->loadObject()
#1 /usr/share/icingaweb2/modules/director/library/Director/Web/Controller/ObjectController.php(90): Icinga\Module\Director\Web\Controller\ObjectController->loadOptionalObject()
#2 /usr/share/icingaweb2/modules/director/application/controllers/ServiceController.php(46): Icinga\Module\Director\Web\Controller\ObjectController->init()
#3 /usr/share/php/Icinga/Web/Controller/ActionController.php(165): Icinga\Module\Director\Controllers\ServiceController->init()
#4 /usr/share/php/Icinga/Web/Controller/Dispatcher.php(59): Icinga\Web\Controller\ActionController->__construct()
#5 /usr/share/icingaweb2/library/vendor/Zend/Controller/Front.php(937): Icinga\Web\Controller\Dispatcher->dispatch(

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

When I add a new service to the same set, I can edit this one without problems, but the other ones still fail.

Possible Solution

Something with the UUID stuff - the $uuid object is empty. I think, there are some entries missing in the database which
URL is: /icingaweb2/director/service?name=dns-verify&set=X-LOM%20SSL

Code:
/usr/share/icingaweb2/modules/director/application/controllers/ServiceController.php:254

# $key="dns-verify"
# $this->host = ""
# $this->set: "template ServiceSet "X-LOM SSL" {\n    description = "Webserver mit SSL, HTTP und DNS Check"\n}\n\n"
$uuid = UuidLookup::findServiceUuid($this->db(), $this->getBranch(), 'object', $key, $this->host, $this->set);
# $uuid is empty

I think it will generate something like this in library/Director/Db/Branch/UuidLookup.php:
select uuid from icinga_service where object_name="dns-verify" and object_type='object' and service_set_id=568
which has no hits in my database.
The code in library/Director/Db/Branch/UuidLookup.php does not enter the isBranch() part and so no uuid is returned.

When I remove the "object_type=object" part from the SQL statement, it just gives one hit with an object_type = "apply".

Doing the same with a fresh added service results in a valid UUID and everything works.

If you further information, just ask :-)

Steps to Reproduce (for bugs)

Can't reproduce it, because new services work - it's just the old ones which fail every time.

Your Environment

  • Director version (System - About): 1.9.0 or git master
  • Icinga Web 2 version and modules (System - About): 2.9.5
  • Icinga 2 version (icinga2 --version): r2.13.2-1
  • Operating System and version: Ubuntu 20.04
  • Webserver, PHP versions: apache2: 2.4.41-4ubuntu3.9, php7.4: 7.4.3-4ubuntu2.8
@log1-c
Copy link

log1-c commented Aug 5, 2022

Should(will be) be fixed with this: #2554

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

No branches or pull requests

2 participants