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

[dev.icinga.com #10828] Relative path in include_zones does not work #3773

Closed
icinga-migration opened this issue Dec 11, 2015 · 3 comments
Closed
Milestone

Comments

@icinga-migration
Copy link
Member

@icinga-migration icinga-migration commented Dec 11, 2015

This issue has been migrated from Redmine: https://dev.icinga.com/issues/10828

Created by mfriedrich on 2015-12-11 15:58:15 +00:00

Assignee: mfriedrich
Status: Resolved (closed on 2015-12-11 16:05:04 +00:00)
Target Version: 2.4.2
Last Update: 2016-02-23 10:24:06 +00:00 (in Redmine)

Icinga Version: 2.4.1
Backport?: Already backported
Include in Changelog: 1

It duplicates relative paths which results in problems with glob'ing the files.

(lldb) br del
About to delete all breakpoints, do you want to do that?: [Y/n] y
All breakpoints removed. (1 breakpoint)
(lldb) b icinga::ConfigCompiler::HandleIncludeZones
Breakpoint 2: where = libconfig.dylib`icinga::ConfigCompiler::HandleIncludeZones(icinga::String const&, icinga::String const&, icinga::String const&, icinga::String const&, icinga::String const&, icinga::DebugInfo const&) + 60 at configcompiler.cpp:214, address = 0x0000000100cd97ec
(lldb) r
There is a running process, kill it and restart?: [Y/n] y
Process 79116 exited with status = 9 (0x00000009)
Process 79649 launched: '/usr/local/icinga2/lib/icinga2/sbin/icinga2' (x86_64)
[2015-12-11 15:27:54 +0100] information/cli: Icinga application loader (version: v2.4.1-66-g138d416; debug)
[2015-12-11 15:27:54 +0100] information/ConfigCompiler: Compiling config file: icinga2a.conf
[2015-12-11 15:27:54 +0100] information/Utility: Loading library 'libchecker.dylib'
[2015-12-11 15:27:54 +0100] information/Utility: Loading library 'libcompat.dylib'
[2015-12-11 15:27:54 +0100] information/Utility: Loading library 'libdb_ido_mysql.dylib'
[2015-12-11 15:27:54 +0100] information/Utility: Loading library 'liblivestatus.dylib'
[2015-12-11 15:27:54 +0100] information/ConfigCompiler: Compiling config file: /usr/local/icinga2/share/icinga2/include/itl
[2015-12-11 15:27:54 +0100] information/ConfigCompiler: Compiling config file: /usr/local/icinga2/share/icinga2/include/command.conf
[2015-12-11 15:27:54 +0100] information/Utility: Loading library 'libmethods.dylib'
[2015-12-11 15:27:54 +0100] information/ConfigCompiler: Compiling config file: /usr/local/icinga2/share/icinga2/include/command-icinga.conf
[2015-12-11 15:27:54 +0100] information/ConfigCompiler: Compiling config file: /usr/local/icinga2/share/icinga2/include/timeperiod.conf
[2015-12-11 15:27:54 +0100] information/ConfigCompiler: Compiling config file: /usr/local/icinga2/share/icinga2/include/plugins
[2015-12-11 15:27:54 +0100] information/ConfigCompiler: Compiling config file: /usr/local/icinga2/share/icinga2/include/command-plugins.conf
[2015-12-11 15:27:54 +0100] information/ConfigCompiler: Compiling config file: icinga2a/lib/icinga2/api/packages/_api/include.conf
[2015-12-11 15:27:54 +0100] information/ConfigCompiler: Compiling config file: icinga2a/lib/icinga2/api/packages/_api/mbmif.int.netways.de-1442332428-0/include.conf
[2015-12-11 15:27:54 +0100] information/ConfigCompiler: Compiling config file: icinga2a/lib/icinga2/api/packages/_api/mbmif.int.netways.de-1442332428-0/../active.conf
[2015-12-11 15:27:54 +0100] information/ConfigCompiler: Compiling config file: icinga2a/lib/icinga2/api/packages/_api/mbmif.int.netways.de-1442332428-0/conf.d/hosts/google.com10.conf
[2015-12-11 15:27:54 +0100] information/ConfigCompiler: Compiling config file: icinga2a/lib/icinga2/api/packages/_api/mbmif.int.netways.de-1442332428-0/conf.d/hosts/google.com11.conf
[2015-12-11 15:27:54 +0100] information/ConfigCompiler: Compiling config file: icinga2a/lib/icinga2/api/packages/_api/mbmif.int.netways.de-1442332428-0/conf.d/hosts/google.com2.conf
[2015-12-11 15:27:54 +0100] information/ConfigCompiler: Compiling config file: icinga2a/lib/icinga2/api/packages/_api/mbmif.int.netways.de-1442332428-0/conf.d/hosts/google.com3.conf
[2015-12-11 15:27:54 +0100] information/ConfigCompiler: Compiling config file: icinga2a/lib/icinga2/api/packages/_api/mbmif.int.netways.de-1442332428-0/conf.d/hosts/google.com6.conf
[2015-12-11 15:27:54 +0100] information/ConfigCompiler: Compiling config file: icinga2a/lib/icinga2/api/packages/_api/mbmif.int.netways.de-1442332428-0/conf.d/hosts/google.com7.conf
[2015-12-11 15:27:54 +0100] information/ConfigCompiler: Compiling config file: icinga2a/lib/icinga2/api/packages/_api/mbmif.int.netways.de-1442332428-0/conf.d/hosts/google.dns.conf
[2015-12-11 15:27:54 +0100] information/ConfigCompiler: Compiling config file: icinga2a/lib/icinga2/api/packages/_api/mbmif.int.netways.de-1442332428-0/conf.d/hosts/google.zone.conf
[2015-12-11 15:27:54 +0100] information/ConfigCompiler: Compiling config file: icinga2a/lib/icinga2/api/packages/_api/mbmif.int.netways.de-1442332428-0/conf.d/hosts/google1.conf
Process 79649 stopped
* thread #1: tid = 0x1bb4da, 0x0000000100cd97ec libconfig.dylib`icinga::ConfigCompiler::HandleIncludeZones(relativeBase=0x000000010193fee0, tag=0x00007fff5fbf7020, path=0x00007fff5fbf7008, pattern=0x00007fff5fbf6ff0, package=0x000000010193ff30, (null)=0x000000010193feb8) + 60 at configcompiler.cpp:214, queue = 'com.apple.main-thread', stop reason = breakpoint 2.1
    frame #0: 0x0000000100cd97ec libconfig.dylib`icinga::ConfigCompiler::HandleIncludeZones(relativeBase=0x000000010193fee0, tag=0x00007fff5fbf7020, path=0x00007fff5fbf7008, pattern=0x00007fff5fbf6ff0, package=0x000000010193ff30, (null)=0x000000010193feb8) + 60 at configcompiler.cpp:214
   211  Expression *ConfigCompiler::HandleIncludeZones(const String& relativeBase, const String& tag,
   212      const String& path, const String& pattern, const String& package, const DebugInfo&)
   213  {
-> 214      String ppath;
   215
   216      if (path.GetLength() > 0 && path[0] == '/')
   217          ppath = path;
(lldb) n
Process 79649 stopped
* thread #1: tid = 0x1bb4da, 0x0000000100cd97f1 libconfig.dylib`icinga::ConfigCompiler::HandleIncludeZones(relativeBase=0x000000010193fee0, tag=0x00007fff5fbf7020, path=0x00007fff5fbf7008, pattern=0x00007fff5fbf6ff0, package=0x000000010193ff30, (null)=0x000000010193feb8) + 65 at configcompiler.cpp:216, queue = 'com.apple.main-thread', stop reason = step over
    frame #0: 0x0000000100cd97f1 libconfig.dylib`icinga::ConfigCompiler::HandleIncludeZones(relativeBase=0x000000010193fee0, tag=0x00007fff5fbf7020, path=0x00007fff5fbf7008, pattern=0x00007fff5fbf6ff0, package=0x000000010193ff30, (null)=0x000000010193feb8) + 65 at configcompiler.cpp:216
   213  {
   214      String ppath;
   215
-> 216      if (path.GetLength() > 0 && path[0] == '/')
   217          ppath = path;
   218      else
   219          ppath = relativeBase + "/" + path;
(lldb) p path
(const icinga::String) $26 = (m_Data = "zones.d")
(lldb) n
Process 79649 stopped
* thread #1: tid = 0x1bb4da, 0x0000000100cd9886 libconfig.dylib`icinga::ConfigCompiler::HandleIncludeZones(relativeBase=0x000000010193fee0, tag=0x00007fff5fbf7020, path=0x00007fff5fbf7008, pattern=0x00007fff5fbf6ff0, package=0x000000010193ff30, (null)=0x000000010193feb8) + 214 at configcompiler.cpp:219, queue = 'com.apple.main-thread', stop reason = step over
    frame #0: 0x0000000100cd9886 libconfig.dylib`icinga::ConfigCompiler::HandleIncludeZones(relativeBase=0x000000010193fee0, tag=0x00007fff5fbf7020, path=0x00007fff5fbf7008, pattern=0x00007fff5fbf6ff0, package=0x000000010193ff30, (null)=0x000000010193feb8) + 214 at configcompiler.cpp:219
   216      if (path.GetLength() > 0 && path[0] == '/')
   217          ppath = path;
   218      else
-> 219          ppath = relativeBase + "/" + path;
   220
   221      std::vector expressions;
   222      Utility::Glob(ppath + "/*", boost::bind(&ConfigCompiler::HandleIncludeZone, relativeBase, tag, _1, pattern, package, boost::ref(expressions)), GlobDirectory);
(lldb) n
Process 79649 stopped
* thread #1: tid = 0x1bb4da, 0x0000000100cd9947 libconfig.dylib`icinga::ConfigCompiler::HandleIncludeZones(relativeBase=0x000000010193fee0, tag=0x00007fff5fbf7020, path=0x00007fff5fbf7008, pattern=0x00007fff5fbf6ff0, package=0x000000010193ff30, (null)=0x000000010193feb8) + 407 at configcompiler.cpp:221, queue = 'com.apple.main-thread', stop reason = step over
    frame #0: 0x0000000100cd9947 libconfig.dylib`icinga::ConfigCompiler::HandleIncludeZones(relativeBase=0x000000010193fee0, tag=0x00007fff5fbf7020, path=0x00007fff5fbf7008, pattern=0x00007fff5fbf6ff0, package=0x000000010193ff30, (null)=0x000000010193feb8) + 407 at configcompiler.cpp:221
   218      else
   219          ppath = relativeBase + "/" + path;
   220
-> 221      std::vector expressions;
   222      Utility::Glob(ppath + "/*", boost::bind(&ConfigCompiler::HandleIncludeZone, relativeBase, tag, _1, pattern, package, boost::ref(expressions)), GlobDirectory);
   223      return new DictExpression(expressions);
   224  }
(lldb) p ppath
(icinga::String) $30 = (m_Data = "icinga2a/lib/icinga2/api/packages/_api/mbmif.int.netways.de-1442332428-0/zones.d")
(lldb) p relativeBase
(const icinga::String) $31 = (m_Data = "icinga2a/lib/icinga2/api/packages/_api/mbmif.int.netways.de-1442332428-0")
(lldb) n
Process 79649 stopped
* thread #1: tid = 0x1bb4da, 0x0000000100cd99f8 libconfig.dylib`icinga::ConfigCompiler::HandleIncludeZones(relativeBase=0x000000010193fee0, tag=0x00007fff5fbf7020, path=0x00007fff5fbf7008, pattern=0x00007fff5fbf6ff0, package=0x000000010193ff30, (null)=0x000000010193feb8) + 584 at configcompiler.cpp:222, queue = 'com.apple.main-thread', stop reason = step over
    frame #0: 0x0000000100cd99f8 libconfig.dylib`icinga::ConfigCompiler::HandleIncludeZones(relativeBase=0x000000010193fee0, tag=0x00007fff5fbf7020, path=0x00007fff5fbf7008, pattern=0x00007fff5fbf6ff0, package=0x000000010193ff30, (null)=0x000000010193feb8) + 584 at configcompiler.cpp:222
   219          ppath = relativeBase + "/" + path;
   220
   221      std::vector expressions;
-> 222      Utility::Glob(ppath + "/*", boost::bind(&ConfigCompiler::HandleIncludeZone, relativeBase, tag, _1, pattern, package, boost::ref(expressions)), GlobDirectory);
   223      return new DictExpression(expressions);
   224  }
   225
(lldb) b icinga::ConfigCompiler::HandleIncludeZone
Breakpoint 3: where = libconfig.dylib`icinga::ConfigCompiler::HandleIncludeZone(icinga::String const&, icinga::String const&, icinga::String const&, icinga::String const&, icinga::String const&, std::__1::vector >&) + 50 at configcompiler.cpp:188, address = 0x0000000100cd9162
(lldb) c
Process 79649 resuming
[2015-12-11 15:28:59 +0100] warning/ThreadPool: Event call took 43.5647s
[2015-12-11 15:29:16 +0100] information/ConfigCompiler: Compiling config file: icinga2a/lib/icinga2/api/packages/example-cmdb/include.conf
[2015-12-11 15:29:16 +0100] information/ConfigCompiler: Compiling config file: icinga2a/lib/icinga2/api/packages/example-cmdb/mbmif.int.netways.de-1449842414-0/include.conf
[2015-12-11 15:29:16 +0100] information/ConfigCompiler: Compiling config file: icinga2a/lib/icinga2/api/packages/example-cmdb/mbmif.int.netways.de-1449842414-0/../active.conf
Process 79649 stopped
* thread #1: tid = 0x1bb4da, 0x0000000100cd97ec libconfig.dylib`icinga::ConfigCompiler::HandleIncludeZones(relativeBase=0x0000000101c60e70, tag=0x00007fff5fbf7020, path=0x00007fff5fbf7008, pattern=0x00007fff5fbf6ff0, package=0x0000000101c60ec0, (null)=0x0000000101c60e48) + 60 at configcompiler.cpp:214, queue = 'com.apple.main-thread', stop reason = breakpoint 2.1
    frame #0: 0x0000000100cd97ec libconfig.dylib`icinga::ConfigCompiler::HandleIncludeZones(relativeBase=0x0000000101c60e70, tag=0x00007fff5fbf7020, path=0x00007fff5fbf7008, pattern=0x00007fff5fbf6ff0, package=0x0000000101c60ec0, (null)=0x0000000101c60e48) + 60 at configcompiler.cpp:214
   211  Expression *ConfigCompiler::HandleIncludeZones(const String& relativeBase, const String& tag,
   212      const String& path, const String& pattern, const String& package, const DebugInfo&)
   213  {
-> 214      String ppath;
   215
   216      if (path.GetLength() > 0 && path[0] == '/')
   217          ppath = path;
(lldb) c
Process 79649 resuming
Process 79649 stopped
* thread #1: tid = 0x1bb4da, 0x0000000100cd9162 libconfig.dylib`icinga::ConfigCompiler::HandleIncludeZone(relativeBase=0x0000000101c28768, tag=0x0000000101c28780, path=0x0000000101c235a0, pattern=0x0000000101c28798, package=0x0000000101c287b0, expressions=size=0) + 50 at configcompiler.cpp:188, queue = 'com.apple.main-thread', stop reason = breakpoint 3.1
    frame #0: 0x0000000100cd9162 libconfig.dylib`icinga::ConfigCompiler::HandleIncludeZone(relativeBase=0x0000000101c28768, tag=0x0000000101c28780, path=0x0000000101c235a0, pattern=0x0000000101c28798, package=0x0000000101c287b0, expressions=size=0) + 50 at configcompiler.cpp:188
   185
   186  void ConfigCompiler::HandleIncludeZone(const String& relativeBase, const String& tag, const String& path, const String& pattern, const String& package, std::vector& expressions)
   187  {
-> 188      String zoneName = Utility::BaseName(path);
   189
   190      String ppath;
   191
(lldb) p path
(const icinga::String) $32 = (m_Data = "icinga2a/lib/icinga2/api/packages/example-cmdb/mbmif.int.netways.de-1449842414-0/zones.d/master")
(lldb) n
Process 79649 stopped
* thread #1: tid = 0x1bb4da, 0x0000000100cd9175 libconfig.dylib`icinga::ConfigCompiler::HandleIncludeZone(relativeBase=0x0000000101c28768, tag=0x0000000101c28780, path=0x0000000101c235a0, pattern=0x0000000101c28798, package=0x0000000101c287b0, expressions=size=0) + 69 at configcompiler.cpp:190, queue = 'com.apple.main-thread', stop reason = step over
    frame #0: 0x0000000100cd9175 libconfig.dylib`icinga::ConfigCompiler::HandleIncludeZone(relativeBase=0x0000000101c28768, tag=0x0000000101c28780, path=0x0000000101c235a0, pattern=0x0000000101c28798, package=0x0000000101c287b0, expressions=size=0) + 69 at configcompiler.cpp:190
   187  {
   188      String zoneName = Utility::BaseName(path);
   189
-> 190      String ppath;
   191
   192      if (path.GetLength() > 0 && path[0] == '/')
   193          ppath = path;
(lldb) p zoneName
(icinga::String) $33 = (m_Data = "master")
(lldb) n
Process 79649 stopped
* thread #1: tid = 0x1bb4da, 0x0000000100cd9186 libconfig.dylib`icinga::ConfigCompiler::HandleIncludeZone(relativeBase=0x0000000101c28768, tag=0x0000000101c28780, path=0x0000000101c235a0, pattern=0x0000000101c28798, package=0x0000000101c287b0, expressions=size=0) + 86 at configcompiler.cpp:192, queue = 'com.apple.main-thread', stop reason = step over
    frame #0: 0x0000000100cd9186 libconfig.dylib`icinga::ConfigCompiler::HandleIncludeZone(relativeBase=0x0000000101c28768, tag=0x0000000101c28780, path=0x0000000101c235a0, pattern=0x0000000101c28798, package=0x0000000101c287b0, expressions=size=0) + 86 at configcompiler.cpp:192
   189
   190      String ppath;
   191
-> 192      if (path.GetLength() > 0 && path[0] == '/')
   193          ppath = path;
   194      else
   195          ppath = relativeBase + "/" + path;
(lldb) n
Process 79649 stopped
* thread #1: tid = 0x1bb4da, 0x0000000100cd922f libconfig.dylib`icinga::ConfigCompiler::HandleIncludeZone(relativeBase=0x0000000101c28768, tag=0x0000000101c28780, path=0x0000000101c235a0, pattern=0x0000000101c28798, package=0x0000000101c287b0, expressions=size=0) + 255 at configcompiler.cpp:195, queue = 'com.apple.main-thread', stop reason = step over
    frame #0: 0x0000000100cd922f libconfig.dylib`icinga::ConfigCompiler::HandleIncludeZone(relativeBase=0x0000000101c28768, tag=0x0000000101c28780, path=0x0000000101c235a0, pattern=0x0000000101c28798, package=0x0000000101c287b0, expressions=size=0) + 255 at configcompiler.cpp:195
   192      if (path.GetLength() > 0 && path[0] == '/')
   193          ppath = path;
   194      else
-> 195          ppath = relativeBase + "/" + path;
   196
   197      RegisterZoneDir(tag, ppath, zoneName);
   198
(lldb) n
[2015-12-11 15:29:49 +0100] warning/ThreadPool: Event call took 1.93306s
Process 79649 stopped
* thread #1: tid = 0x1bb4da, 0x0000000100cd92e6 libconfig.dylib`icinga::ConfigCompiler::HandleIncludeZone(relativeBase=0x0000000101c28768, tag=0x0000000101c28780, path=0x0000000101c235a0, pattern=0x0000000101c28798, package=0x0000000101c287b0, expressions=size=0) + 438 at configcompiler.cpp:197, queue = 'com.apple.main-thread', stop reason = step over
    frame #0: 0x0000000100cd92e6 libconfig.dylib`icinga::ConfigCompiler::HandleIncludeZone(relativeBase=0x0000000101c28768, tag=0x0000000101c28780, path=0x0000000101c235a0, pattern=0x0000000101c28798, package=0x0000000101c287b0, expressions=size=0) + 438 at configcompiler.cpp:197
   194      else
   195          ppath = relativeBase + "/" + path;
   196
-> 197      RegisterZoneDir(tag, ppath, zoneName);
   198
   199      Utility::GlobRecursive(ppath, pattern, boost::bind(&ConfigCompiler::CollectIncludes, boost::ref(expressions), _1, zoneName, package), GlobFile);
   200  }
(lldb) p ppath
(icinga::String) $37 = (m_Data = "icinga2a/lib/icinga2/api/packages/example-cmdb/mbmif.int.netways.de-1449842414-0/icinga2a/lib/icinga2/api/packages/example-cmdb/mbmif.int.netways.de-1449842414-0/zones.d/master")
(lldb) p tag
(const icinga::String) $38 = (m_Data = "example-cmdb")
(lldb) p zoneName
(icinga::String) $39 = (m_Data = "master")
(lldb) p path
(const icinga::String) $40 = (m_Data = "icinga2a/lib/icinga2/api/packages/example-cmdb/mbmif.int.netways.de-1449842414-0/zones.d/master")

Changesets

2015-12-11 15:58:43 +00:00 by mfriedrich e5ca19b

Fix that relative paths do not work with include_zones

fixes #10828

2016-02-23 08:09:20 +00:00 by mfriedrich db0e8c6

Fix that relative paths do not work with include_zones

fixes #10828
@icinga-migration
Copy link
Member Author

@icinga-migration icinga-migration commented Dec 11, 2015

Updated by mfriedrich on 2015-12-11 16:05:04 +00:00

  • Status changed from Assigned to Resolved
  • Done % changed from 0 to 100

Applied in changeset e5ca19b.

@icinga-migration
Copy link
Member Author

@icinga-migration icinga-migration commented Feb 23, 2016

Updated by gbeutner on 2016-02-23 09:58:31 +00:00

  • Backport? changed from Not yet backported to Already backported
@icinga-migration
Copy link
Member Author

@icinga-migration icinga-migration commented Feb 23, 2016

Updated by gbeutner on 2016-02-23 10:24:06 +00:00

  • Target Version changed from 2.5.0 to 2.4.2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant
You can’t perform that action at this time.