5 Replies Latest reply on Jul 14, 2015 6:47 AM by Bill Robinson

    Configuration File. Add multiple files from multiple servers?

    Carlos Rodríguez

      Hi,

      I need to create as many "configuration files" as files "web.config" exists in all servers. The number of files "web.config" is variable, the location of the web.config file is also variable. How can I do?.

       

      I tested the functionality "Add multiple files (File wilcarded path) from server" and get the expected result but only the server established , is necessary many "configuration files" as servers? How can you do it with blcli ?

       

      Captura2.png

       

       

      greetings!

        • 1. Re: Configuration File. Add multiple files from multiple servers?
          Bill Robinson

          Run a find command to find the path to the files, feed that into the blcli ServerConfigDef createServerConfigDef in a loop.

          • 2. Re: Configuration File. Add multiple files from multiple servers?
            Carlos Rodríguez

            Hello Bill, thanks for your response. I'm running tests with one file, I used ServerConfigDef createServerConfigDef to create a configuration file, it exists in the "Config objects Dictionary" but does not exist in the live server node where there is that path.

            How can I associate a configuration file to a particular server?

            What does in background the functionality "Add multiple files (File wilcarded path) from server"? I can do the same on the command line?

             

             

            thank you very much!

            • 3. Re: Configuration File. Add multiple files from multiple servers?
              Bill Robinson

              you don't associate a cfo to a certain server.  if the file exists on the server it will show up in the live browse under 'configurations', if it doesn't exist, then it won't show up.

               

              are you trying to deploy this file to a server ?

              • 4. Re: Configuration File. Add multiple files from multiple servers?
                Carlos Rodríguez

                Hello @Bill, I'm trying to discover all web.config files that exist on multiple servers for compliance with  remediation for some parameters. The files already exist on servers but its path is variable.

                 

                 

                This is the script with the blcli commands I used to discovery:

                 

                 

                ###############################################################################################

                #!/bin/nsh

                 

                _PLATFORM=$1 # WindowsNT

                _GRAMMAR=$2  # web.config.xml.gm

                 

                blcli_connect

                 

                for _DOS_PATH in $(nexec -e cmd.exe /c "where /r d:\websites\Sites Web.config") ; do

                 

                  # convert windows path to nsh path

                 

                  _NSH_PATH=$(echo -E "$_DOS_PATH" | sed 's/\\/\//g' | sed s/'^\(.\):'/'\/\1'/g)

                 

                  # configuration files

                 

                  blcli_execute ServerConfigDef isExistsByNameAndOS "$_NSH_PATH" "$_PLATFORM" && blcli_storeenv _EXIST

                 

                  if [ "$_EXIST" = "false" ] ; then

                 

                  blcli_execute ServerConfigDef createServerConfigDef "$_NSH_PATH" "$_GRAMMAR" "$_PLATFORM"

                 

                  else

                 

                  echo "INFO: ${_NSH_PATH} EXISTS"

                 

                  fi

                done

                 

                 

                ###############################################################################################

                 

                This creates the objects in the dictionary but are not visible from the server that I run it.

                 

                I'm considering create a component template with a property "MYPATH" and "n" instances (as many as files resulting from "where" command).

                I keep thinking of other ways to perform this discovery .... any ideas?

                 

                PD.- the "find" in windows does not work well ... so I use native command "where" and I have to translate the paths to NSH.

                 

                 

                Thank you very much !!

                • 5. Re: Configuration File. Add multiple files from multiple servers?
                  Bill Robinson

                  check to make sure there are no extra blank or control characters in the path you are putting in ?  and the path might need to be a case match w/ what case you see in live browse.

                   

                  your sed bit also has an error:

                  's/\\/\//g' | sed s/'^\(.\):'/'\/\1'/g

                  should be

                  's/\\/\//g' | sed s/'^\(.\):'/'\/\1/g'