2 Replies Latest reply on Apr 6, 2013 4:20 AM by Abin Mammala

    Component create NSH job

    Abin Mammala

      Hello,

       

      I am creating an empty template using the following script (Provided by Siddu):

       

      blcred cred -acquire -profile defaultProfile -username BLAdmin -password 1855101

      blcli_setoption serviceProfileName defaultProfile

      blcli_setoption roleName BLAdmins

      blcli_connect

       

      TEMPLATE_NAME="Abin"

      TEMPLATE_GROUP="/Test"

      echo $TEMPLATE_GROUP

      blcli_execute TemplateGroup groupNameToId "${TEMPLATE_GROUP}"

      blcli_storeenv TEMPLATE_GROUP_ID

       

       

      bExplicit="true"

      SIGNATURE_EVAL="true"

      blcli_execute Template createEmptyTemplate $TEMPLATE_NAME $TEMPLATE_GROUP_ID $bExplicit $SIGNATURE_EVAL

       

      Now, I need to create an NSH job with the above commands. I will have 100 template names ina  text file and I need to create all the 100 templates with the names in the text file.

       

      Is tha possible?

       

       

      Thanks

      Abin

        • 1. Re: Component create NSH job
          Siddu angadi

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

           

          blcred cred -acquire -profile defaultProfile -username BLAdmin -password 1855101

          blcli_setoption serviceProfileName defaultProfile

          blcli_setoption roleName BLAdmins

          blcli_connect

           

           

          Lines=`cat /tmp/template.csv`

           

           

          for line in $Lines

           

           

          do

                    TEMPLATE_NAME=`echo $line | cut -d ',' -f1`

                    TEMPLATE_GROUP=`echo $line | cut -d ',' -f2`

                    echo $TEMPLATE_GROUP

                    blcli_execute TemplateGroup groupNameToId "${TEMPLATE_GROUP}"

                    blcli_storeenv TEMPLATE_GROUP_ID

                              

                    bExplicit="true"

                    SIGNATURE_EVAL="true"

                    blcli_execute Template createEmptyTemplate $TEMPLATE_NAME $TEMPLATE_GROUP_ID $bExplicit $SIGNATURE_EVAL

          done

           

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

           

           

          your template.csv should have template Name and group information, as example

           

          Abin,/Test

          siddu,/Test

           

           

          Thanks

          Siddu


          • 2. Re: Component create NSH job
            Abin Mammala

            Hello Siddu,

             

            Thank you very much for the script.

             

            I also added the line to add the configuration file to the template:

             

            blcred cred -acquire -profile defaultProfile -username BLAdmin -password 1855101

            blcli_setoption serviceProfileName defaultProfile

            blcli_setoption roleName BLAdmins

            blcli_connect

             

            Lines=`cat /c/template.csv`

             

             

            for line in $Lines

             

             

            do

                      TEMPLATE_NAME=`echo $line | cut -d ',' -f1`

                          echo $TEMPLATE_NAME

                      TEMPLATE_GROUP=`echo $line | cut -d ',' -f2`

                      echo $TEMPLATE_GROUP

                          TEMPLATE_PART=`echo $line | cut -d ',' -f3`

                          echo $TEMPLATE_GROUP

                      blcli_execute TemplateGroup groupNameToId "${TEMPLATE_GROUP}"

                      blcli_storeenv TEMPLATE_GROUP_ID

                               

                      bExplicit="true"

                      SIGNATURE_EVAL="true"

                      blcli_execute Template createEmptyTemplate "${TEMPLATE_NAME}" "${TEMPLATE_GROUP_ID}" $bExplicit $SIGNATURE_EVAL

                          blcli_storeenv templateKey              

                      blcli_execute Template createLocalServerConfigDef $templateKey "${TEMPLATE_PART}" "auto.gm" Linux

             

             

            done