From b2fc6a3399822b3cbfa7f4fb0c4c274b74fea483 Mon Sep 17 00:00:00 2001 From: svkalinin Date: Fri, 16 Sep 2022 16:27:59 +0300 Subject: [PATCH] =?UTF-8?q?=D0=9A=D1=83=D0=B0=D1=84=D1=81=D0=B5=D1=89?= =?UTF-8?q?=D0=BA=D1=88=D1=82=D0=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/readstructure.tcl | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/lib/readstructure.tcl b/lib/readstructure.tcl index c306adb..cb11767 100644 --- a/lib/readstructure.tcl +++ b/lib/readstructure.tcl @@ -132,17 +132,20 @@ proc ReadFilesFromDirectory {directory root {type ""}} { } if {[string match {*inventory*} [string tolower $fileName]]} { lappend project($root) [file join $root $directory $fileName] - set variables([file join $root $directory $fileName]) [GetVariablesFromVarFile [file join $root $directory $fileName]] + set variables([file join $root $directory $fileName]) \ + [GetVariablesFromVarFile [file join $root $directory $fileName]] } if {[string tolower $fileName] eq "ansible.cfg"} { # puts "find ansible.cfg [file join $root $directory $fileName]" set f [open [file join $root $directory $fileName] r] while {[gets $f line] >= 0} { - # puts "\t$line" - if [regexp -nocase -all -- {^\s*inventory\s*=\s*(.+?)$} $line match fileName] { + if [regexp -nocase -all -- {^\s*inventory\s*=\s*(\.\/|)(.+?)$} $line match v1 fileName] { # puts "Inventory file is a: $line" + if {[lsearch $project($root) [file join $root $directory $fileName]] eq "-1"} { lappend project($root) [file join $root $directory $fileName] - set variables([file join $root $directory $fileName]) [GetVariablesFromVarFile [file join $root $directory $fileName]] + set variables([file join $root $directory $fileName]) \ + [GetVariablesFromVarFile [file join $root $directory $fileName]] + } } } close $f @@ -153,7 +156,8 @@ proc ReadFilesFromDirectory {directory root {type ""}} { # puts "[GetVariablesFromFile $fileName]" # dict set project $root [file join $root $directory $fileName];# "[GetVariablesFromFile $fileName]" lappend project($root) [file join $root $directory $fileName] - set variables([file join $root $directory $fileName]) [GetVariablesFromVarFile [file join $root $directory $fileName]] + set variables([file join $root $directory $fileName]) \ + [GetVariablesFromVarFile [file join $root $directory $fileName]] # puts "[file join $root $directory $fileName]---$variables([file join $root $directory $fileName])" } }