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

Renders wrong config #2289

Closed
ph-t-G opened this issue Feb 18, 2021 · 7 comments · Fixed by #2298
Closed

Renders wrong config #2289

ph-t-G opened this issue Feb 18, 2021 · 7 comments · Fixed by #2298
Assignees
Milestone

Comments

@ph-t-G
Copy link

ph-t-G commented Feb 18, 2021

Expected Behavior

Deploying a new cofiguration after an upgrade led to this error:

critical/config: Error: Dependency "....." references a parent host/service which doesn't exist.
Location: in [stage]/zones.d/director-global/dependency_apply.conf: 8:1-8:43
[stage]/zones.d/director-global/dependency_apply.conf(6): }
[stage]/zones.d/director-global/dependency_apply.conf(7): 
[stage]/zones.d/director-global/dependency_apply.conf(8): apply Dependency "ApacheVsVhost" to Service {
                                                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[stage]/zones.d/director-global/dependency_apply.conf(9):     import "Dependency Template"
[stage]/zones.d/director-global/dependency_apply.conf(10): 

The dependency_apply.conf should look like this.

apply Dependency "TomcatVsAJPPort" to Service {
    import "Dependency Template"
    assign where host.vars.tomcat_ajps && match("AJP Port *", service.name)
    parent_service_name = service.vars.parent_service_name
}

Current Behavior

image

But the config looks like this.

apply Dependency "TomcatVsAJPPort" to Service {
    import "Dependency Template"
    assign where host.vars.tomcat_ajps && match("AJP Port *", service.name)
    parent_service_name = "$service.vars.parent_service_name$"
}


Possible Solution

Steps to Reproduce (for bugs)

Your Environment

  • Director version (System - About): Current Master (e2a8886)
  • Icinga Web 2 version and modules (System - About): 2.8.3
  • Icinga 2 version (icinga2 --version): 2.12.0-506
  • Operating System and version: Centos 7
  • Webserver, PHP versions: Apache, PHP 7.3
@Nathaniel-Donahue
Copy link
Contributor

ref/NC/702512

@lippserd
Copy link
Member

Hi,

The error from the logs is about dependency ApacheVsVhost. You've pasted config for dependency TomcatVsAJPPort.
Is TomcatVsAJPPort also rendered incorrectly? Could you please post the relevant logs.

All the best,
Eric

@friesoft
Copy link
Contributor

friesoft commented Mar 3, 2021

Yes the TomcatVsAJPPort is also rendered incorrectly - same problem, log looks exactly the same except the exchanged names.
All dependencies we have in director and reference the parent_service_name via a custom variable are affected

@lippserd
Copy link
Member

lippserd commented Mar 9, 2021

I'm wondering whether and how this has worked before. I've checked version 1.7.2. Director does not seem to support custom vars for parent_service_name. Maybe the apply rule was rendered incorrectly before so that it did not match any objects.

@stevie-sy
Copy link

There is still an open issue #1142

@lippserd
Copy link
Member

lippserd commented Mar 9, 2021

There is still an open issue #1142

True, but that one is about selecting an actual service where Director uses parent_service_id. Here, Director uses parent_service_by_name which is just set to a simple string and does not check whether the string pretends to be a custom variable.

@stevie-sy
Copy link

Ok, we are still waiting for the fix. So hopefully both methods will work soon :-)

@nilmerg nilmerg added this to the v1.11.1 milestone Feb 2, 2024
nilmerg added a commit that referenced this issue Feb 7, 2024
#2298)

Earlier the director did not support the rendering of service custom
variables for Parent Service in Dependencies form. Here, this issue is
fixed.

fixes #2289
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
7 participants