7 Replies Latest reply on Jul 25, 2014 9:28 AM by Nick Chard

    auto reformatting of config files

    Nick Chard

      Hi all

      I have been using BladeLogic to edit some web.config files. When I create a package that contains some contents which is to be changed in the web.config file, I have found that a BladeLogic job to deploy the package will add or modify the content as expected.

       

      However, it also reformats the entire web.config file. It changes the order of entries within nodes so that they are listed alphabetically, it removes spaces, it collates things onto one line etc.

       

      Is this normal behaviour? is there a way to stop this reformatting from happening? It's not necessarily a bad thing, I just don't like the idea that something is being changed that I'm not targeting.

       

      Thanks

       

      Nick

        • 1. Re: auto reformatting of config files
          Robert Stinnett

          We have seen this behavior as well when using the configuration dictionary.  It was wreaking havoc with our Control-M agent installs.  Support verified this was happening, but I've yet to hear back whether they classify it as a bug or not.

           

          Robert


          • 2. Re: auto reformatting of config files
            Monoj Padhy

            can you post some samples of entries added and earlier format and latest format of config file. Probably BSA is altering the formatting of config file but we can avoid with some precaution steps.

            • 3. Re: auto reformatting of config files
              Nick Chard

              Below are a couple of examples of entries in the config file that are changed. The job I am running deploys a package which makes a small change to one part of the file, but I find that the whole file is changed when I compare them before and after.

               

               

              <compiler language="c#;cs;csharp" extension=".cs" type="Microsoft.CSharp.CSharpCodeProvider, System, Version=2.0.0.0, Culture=neutral...

               

              <compiler extension=".cs" language="c#;cs;csharp" type="Microsoft.CSharp.CSharpCodeProvider, System, Version=2.0.0.0, Culture=neutral...

               

               

              <add key="ApplicationModule" value="56"></add>

               

              <add key="ApplicationModule" value="56"/>

              • 4. Re: auto reformatting of config files
                Monoj Padhy

                Please share old and latest format of the config file.

                 

                How you are adding the entries. what commands were used.

                • 5. Re: auto reformatting of config files
                  Nick Chard

                  I don't think I can share the whole config file because it contains private business data. I can give a more detailed breakdown of exactly what is being changed if that is necessary.

                   

                  This is the process I used to modify the config file

                  1.Create a Component template which contains a Local Configuration Object with a path of the config file to be changed, using a grammar file "Web Config XML file grammar for IIS 7"

                  2. Run a Component discovery job

                  3. Browse the discovered Component, select the config file and Add to depot as BLPackage

                  4. Open the Package. Delete or Comment Out everything except the value to be changed. Change the value to whatever is required.

                  5. Run a job to deploy the package

                  • 6. Re: auto reformatting of config files
                    Monoj Padhy

                    I can give a more detailed breakdown of exactly what is being changed if that is necessary. >> this would be useful if you could share the expected format for the config file after package deploy.

                     

                    To comment on this one would need the the expected format and changed format.

                    • 7. Re: auto reformatting of config files
                      Nick Chard

                      The expected format is that only what I am targeting should be changed within the config file.

                      An example of something I have tried to change is below.

                       

                      This is the original log4net section of the config file

                       

                      <log4net>

                          <appender name="MyLoggingAppender" type="log4net">

                            <param name="Threshold" value="DEBUG"/>

                          </appender>

                          <root>

                            <priority value="DEBUG"/>

                            <appender-ref ref="MyLoggingAppender"/>

                            <appender-ref ref="RollingFileAppender"/>

                            <applicationName value="MyApplication"/>

                            <applicationVersion value="1.0.0.1"/>

                          </root>

                        </log4net>

                       

                      After the change it looks like this

                       

                      <log4net>

                          <appender name="MyLoggingAppender" type="log4net">

                            <param name="Threshold" value="WARN"/>

                          </appender>

                          <root>

                            <priority value="WARN"/>

                            <appender-ref ref="MyLoggingAppender"/>

                            <appender-ref ref="RollingFileAppender"/>

                            <applicationName value="MyApplication"/>

                            <applicationVersion value="1.0.0.1"/>

                          </root>

                        </log4net>

                       

                      This is expected, and should be the only change that is made to the config file.

                      But the other parts of the config file have also been changed, the first line has changed from

                      <?xml version="1.0" encoding="UTF8"?>

                      to

                      <?xml version="1.0" encoding="UTF8" standalone="no" ?>

                       

                      AppSettings has changed from:

                       

                      <appSettings>
                          <add key="Name" value="FormatName:Direct=OS:Server\queue$\queuename"/>
                          <add key="ApplicationModule" value="56"></add>
                          <add key="ApplicationTab" value="56"></add>
                          <add key="ConnectionString" value="xxxxxxxxx"/>
                        </appSettings>

                       

                      to:

                       

                      <appSettings>
                          <add key="Name" value="FormatName:Direct=OS:Server\queue$\queuename"/>
                          <add key="ApplicationModule" value="56"/>
                          <add key="ApplicationTab" value="56"/>
                          <add key="ConnectionString" value="xxxxxxxxx"/>
                        </appSettings>

                       

                       

                      All other sections of the config file have also changed. It is not a change to the content, but a change to the layout and format.

                      all the parts that weren't changed have been overwritten with the original content but in a way the BladeLogic thinks a file of this type should be laid out.