From 73a2922aa09aa7473e3a642c30cb3267ab692c69 Mon Sep 17 00:00:00 2001 From: Paul Menzel Date: Thu, 6 May 2021 20:57:29 +0200 Subject: [PATCH] hostconfig: Use `mkdir -p` to create possible non-existing directory `/node` MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit # systemctl status startup-tags.service ● startup-tags.service Loaded: loaded (/etc/systemd/system/startup-tags.service; static) Active: failed (Result: exit-code) since Thu 2021-05-06 20:46:29 CEST; 4min 11s ago Process: 1297907 ExecStart=/usr/sbin/hostconfig --populate-node (code=exited, status=2) Main PID: 1297907 (code=exited, status=2) May 06 20:46:29 flughafenberlinbrandenburgwillybrandt systemd[1]: Starting startup-tags.service... May 06 20:46:29 flughafenberlinbrandenburgwillybrandt hostconfig[1297907]: /node/tags: No such file or directory May 06 20:46:29 flughafenberlinbrandenburgwillybrandt systemd[1]: startup-tags.service: Main process exited, code=exited, status=2/INVALIDARGUMENT May 06 20:46:29 flughafenberlinbrandenburgwillybrandt systemd[1]: startup-tags.service: Failed with result 'exit-code'. May 06 20:46:29 flughafenberlinbrandenburgwillybrandt systemd[1]: Failed to start startup-tags.service. --- hostconfig/hostconfig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hostconfig/hostconfig b/hostconfig/hostconfig index 6283c05..8d98aad 100755 --- a/hostconfig/hostconfig +++ b/hostconfig/hostconfig @@ -56,8 +56,8 @@ sub evalue_expression { sub populate_node { my ($hostname)=@_; my $DIR='/node/tags'; - -d $DIR and system "rm -rf $DIR" and exit 1; - mkdir $DIR or die "$DIR: $!\n"; + -d $DIR and system 'rm', '-rf', $DIR and exit 1; + system 'mkdir', '-p', $DIR and exit 1; my $tags=$TAGS{$hostname}; for (keys %$tags) { open my $touch,'>',"$DIR/$_";