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 #10231] MkDirP not working on Windows #3442

Closed
icinga-migration opened this issue Sep 28, 2015 · 9 comments
Closed

[dev.icinga.com #10231] MkDirP not working on Windows #3442

icinga-migration opened this issue Sep 28, 2015 · 9 comments
Labels
Milestone

Comments

@icinga-migration
Copy link
Member

@icinga-migration icinga-migration commented Sep 28, 2015

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

Created by mfrosch on 2015-09-28 13:53:20 +00:00

Assignee: mfriedrich
Status: Resolved (closed on 2016-03-07 08:25:05 +00:00)
Target Version: 2.4.4
Last Update: 2016-03-11 14:51:17 +00:00 (in Redmine)

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

I call it the "mkdir --no-parents" problem.

Lets say I have a file structure like this:

tree /etc/icinga2/zones.d/
/etc/icinga2/zones.d/
├── README
└── satellite
    └── test
        └── hosts
            └── test.conf

When there is no non-empty file inside satellite/test/, the config sync silently fails, while not creating even the directory "test".

Looks like while trying to create directories for files, we not handle a non existing parent directory.

This only happens on Windows as far as I tested it...

Basically the agent is looping while refreshing the config and reloading itself:

[2015-09-28 15:41:30 Mitteleuropäische Sommerzeit] information/ApiListener: New client connection for identity 'debian-icinga.torania.lazyfrosch.de'
[2015-09-28 15:41:30 Mitteleuropäische Sommerzeit] information/ApiListener: Updating configuration file: C:\Program Files (x86)\ICINGA2\var/lib/icinga2/api/zones/windows7.vm.lazyfrosch.de//_etc/hostgroups/test.conf
[2015-09-28 15:41:30 Mitteleuropäische Sommerzeit] information/ApiListener: Restarting after configuration change.
[2015-09-28 15:41:31 Mitteleuropäische Sommerzeit] information/Application: Got reload command: Starting new instance.
[2015-09-28 15:41:34 Mitteleuropäische Sommerzeit] information/ConfigItem: Activated all objects.
[2015-09-28 15:41:34 Mitteleuropäische Sommerzeit] information/ApiClient: Reconnecting to API endpoint 'debian-icinga.torania.lazyfrosch.de' via host 'debian-icinga.torania.lazyfrosch.de' and port '5665'
[2015-09-28 15:41:34 Mitteleuropäische Sommerzeit] information/ApiListener: New client connection for identity 'debian-icinga.torania.lazyfrosch.de'
[2015-09-28 15:41:34 Mitteleuropäische Sommerzeit] information/ApiListener: Updating configuration file: C:\Program Files (x86)\ICINGA2\var/lib/icinga2/api/zones/windows7.vm.lazyfrosch.de//_etc/hostgroups/test.conf
[2015-09-28 15:41:34 Mitteleuropäische Sommerzeit] information/ApiListener: Restarting after configuration change.
[2015-09-28 15:41:35 Mitteleuropäische Sommerzeit] information/Application: Got reload command: Starting new instance.

Attachments

Changesets

2016-03-03 14:54:35 +00:00 by mfriedrich d14477c

Fix MkDirP() on Windows

fixes #10231

2016-03-07 08:22:07 +00:00 by mfriedrich 65cbf04

Fix: MkDirP supports '/' and '\' on Windows

fixes #10231

2016-03-11 14:50:57 +00:00 by mfriedrich 9e833d7

Fix MkDirP() on Windows

fixes #10231

2016-03-11 14:51:08 +00:00 by mfriedrich baecdc3

Fix: MkDirP supports '/' and '\' on Windows

fixes #10231

Relations:

@icinga-migration
Copy link
Member Author

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

Updated by mfriedrich on 2016-02-24 22:49:50 +00:00

  • Relates set to 11036
@icinga-migration
Copy link
Member Author

@icinga-migration icinga-migration commented Mar 3, 2016

Updated by mfriedrich on 2016-03-03 08:24:58 +00:00

  • Status changed from New to Assigned
  • Assigned to set to mfriedrich
  • Target Version set to 2.4.4
@icinga-migration
Copy link
Member Author

@icinga-migration icinga-migration commented Mar 3, 2016

Updated by mfriedrich on 2016-03-03 12:45:28 +00:00

2.4.3 throws an exception.

[2016-03-03 13:42:29 Mitteleuropõische Zeit] warning/JsonRpcConnection: Error while processing message for identity 'mbmif.int.netways.de'
Error: Function call 'mkdir' for file 'C:\Program Files (x86)\ICINGA2\var\lib\icinga2\api\zones\global\\_etc\test\hosts' failed with error code 2, 'No such file or directory'
@icinga-migration
Copy link
Member Author

@icinga-migration icinga-migration commented Mar 3, 2016

Updated by mfriedrich on 2016-03-03 14:37:23 +00:00

Fix and some (to be removed) debug output. The culprit is the "/" on Windows, the win32 api functions provide support for both, slash and backslash notation. Find() does not ;-)

[2016-03-03 15:27:15 +0100] information/ApiListener: Finished sending config updates for endpoint 'mbmif.int.netways.de'.
[2016-03-03 15:27:15 +0100] critical/Utility: MkDir with path 'C:\Program Files (x86)'.
[2016-03-03 15:27:15 +0100] information/ApiListener: Sending replay log for endpoint 'mbmif.int.netways.de'.
[2016-03-03 15:27:15 +0100] critical/Utility: MkDir with path 'C:\Program Files (x86)\ICINGA2'.
[2016-03-03 15:27:15 +0100] information/ApiListener: Finished sending replay log for endpoint 'mbmif.int.netways.de'.
[2016-03-03 15:27:15 +0100] critical/Utility: MkDir with path 'C:\Program Files (x86)\ICINGA2\var/lib/icinga2/api/zones/global'.
[2016-03-03 15:27:15 +0100] information/ApiListener: Updating configuration file: C:\Program Files (x86)\ICINGA2\var/lib/icinga2/api/zones/global//_etc/test/hosts/test.conf
[2016-03-03 15:27:15 +0100] critical/Utility: MkDirP with path 'C:\Program Files (x86)\ICINGA2\var\lib\icinga2\api\zones\global\\_etc\test\hosts'.
[2016-03-03 15:27:15 +0100] critical/Utility: MkDir with path 'C:'.
[2016-03-03 15:27:15 +0100] critical/Utility: MkDir with path 'C:\Program Files (x86)'.
[2016-03-03 15:27:15 +0100] critical/Utility: MkDir with path 'C:\Program Files (x86)\ICINGA2'.
[2016-03-03 15:27:15 +0100] critical/Utility: MkDir with path 'C:\Program Files (x86)\ICINGA2\var'.
[2016-03-03 15:27:15 +0100] critical/Utility: MkDir with path 'C:\Program Files (x86)\ICINGA2\var\lib'.
[2016-03-03 15:27:15 +0100] critical/Utility: MkDir with path 'C:\Program Files (x86)\ICINGA2\var\lib\icinga2'.
[2016-03-03 15:27:15 +0100] critical/Utility: MkDir with path 'C:\Program Files (x86)\ICINGA2\var\lib\icinga2\api'.
[2016-03-03 15:27:15 +0100] critical/Utility: MkDir with path 'C:\Program Files (x86)\ICINGA2\var\lib\icinga2\api\zones'.
[2016-03-03 15:27:15 +0100] critical/Utility: MkDir with path 'C:\Program Files (x86)\ICINGA2\var\lib\icinga2\api\zones\global'.
[2016-03-03 15:27:15 +0100] critical/Utility: MkDir with path 'C:\Program Files (x86)\ICINGA2\var\lib\icinga2\api\zones\global\'.
[2016-03-03 15:27:15 +0100] critical/Utility: MkDir with path 'C:\Program Files (x86)\ICINGA2\var\lib\icinga2\api\zones\global\\_etc'.
[2016-03-03 15:27:15 +0100] critical/Utility: MkDir with path 'C:\Program Files (x86)\ICINGA2\var\lib\icinga2\api\zones\global\\_etc\test'.
[2016-03-03 15:27:15 +0100] critical/Utility: MkDir with path 'C:\Program Files (x86)\ICINGA2\var\lib\icinga2\api\zones\global\\_etc\test\hosts'.
[2016-03-03 15:27:15 +0100] information/ApiListener: Restarting after configuration change.
[2016-03-03 15:27:17 +0100] information/Application: Got reload command: Starting new instance.

c:\Users\michi\Documents\Visual Studio 2015\Projects\icinga2\Bin\Release\Debug>icinga2.exe daemon
@icinga-migration
Copy link
Member Author

@icinga-migration icinga-migration commented Mar 3, 2016

Updated by mfriedrich on 2016-03-03 14:51:15 +00:00

  • File added icinga_10231.png

icinga_10231.png

@icinga-migration
Copy link
Member Author

@icinga-migration icinga-migration commented Mar 3, 2016

Updated by mfriedrich on 2016-03-03 15:00:06 +00:00

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

Applied in changeset d14477c.

@icinga-migration
Copy link
Member Author

@icinga-migration icinga-migration commented Mar 7, 2016

Updated by mfriedrich on 2016-03-07 08:21:46 +00:00

  • Subject changed from Config sync has problems with directories without files on Windows to MkDirP not working on Windows
  • Status changed from Resolved to Assigned
@icinga-migration
Copy link
Member Author

@icinga-migration icinga-migration commented Mar 7, 2016

Updated by mfriedrich on 2016-03-07 08:25:05 +00:00

  • Status changed from Assigned to Resolved

Applied in changeset 65cbf04.

@icinga-migration
Copy link
Member Author

@icinga-migration icinga-migration commented Mar 11, 2016

Updated by mfriedrich on 2016-03-11 14:51:17 +00:00

  • Backport? changed from Not yet backported to Already backported
@icinga-migration icinga-migration added this to the 2.4.4 milestone Jan 17, 2017
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.