2 Replies Latest reply on Jun 1, 2016 5:34 PM by Kai Hintze

    Trying to create BL folder in an nsh script. Fails with "Invalid qualified group name : Work"

    Kai Hintze

      I'm trying to create a work folder in an nsh script. It fails, and I can't see why. I can create the folder in the GUI, but I want it to be scripted so that the script doesn't fail if something happens to the folder.

       

      The script says:

      # First we need a work directory.

      ParentGroup="/BLAdmins Jobs/Recommended Scheduled Jobs"

      if ! $(blcli JobGroup groupExists "$ParentGroup")

      then

         print "ERROR: What happened to $ParentGroup?"

         exit

      fi

      WorkGroup="$ParentGroup/Work"

      if [[ $(blcli JobGroup groupExists "$WorkGroup") == "false" ]]

      then

         WorkGroupID=$(blcli JobGroup createGroupWithParentName "$ParentGroup" "Work")

      fi

       

      When I run it with nsh +xv myscript.nsh I get:

       

      # First we need a work directory.

      ParentGroup="/BLAdmins Jobs/Recommended Scheduled Jobs"

      +run_updates.nsh:6> ParentGroup='/BLAdmins Jobs/Recommended Scheduled Jobs'

      if ! $(blcli JobGroup groupExists "$ParentGroup")

      then

         print "ERROR: What happened to $ParentGroup?"

         exit

      fi

      +run_updates.nsh:1> blcli JobGroup groupExists '/BLAdmins Jobs/Recommended Scheduled Jobs'

      +run_updates.nsh:7> true

       

       

      WorkGroup="$ParentGroup/Work"

      +run_updates.nsh:13> WorkGroup='/BLAdmins Jobs/Recommended Scheduled Jobs/Work'

      if [[ $(blcli JobGroup groupExists "$WorkGroup") == "false" ]]

      then

         WorkGroupID=$(blcli JobGroup createGroupWithParentName "$ParentGroup" "Work")

      fi

      +run_updates.nsh:14> [[+run_updates.nsh:1> blcli JobGroup groupExists '/BLAdmins Jobs/Recommended Scheduled Jobs/Work'

      +run_updates.nsh:14> [[ false == false ]]

      +run_updates.nsh:16> WorkGroupID=+run_updates.nsh:1> blcli JobGroup createGroupWithParentName '/BLAdmins Jobs/Recommended Scheduled     Jobs' Work

      +run_updates.nsh:16> WorkGroupID='Command execution failed.  Invalid qualified group name : Work'

       

      Any suggestions why it fails?

       

      Thanks!

       

      Kai

        • 1. Re: Trying to create BL folder in an nsh script. Fails with "Invalid qualified group name : Work"
          Bill Robinson

          first you should stop using FOO=`blcli blah`. the performance commands (blcli_execute) are faster.  that isn't directly related to your problem though.  your problem is you have given the args in the wrong order.  createGroupWithParentName takes the args grouptocreate parentgroup.  you have them flipped:

           

          ParentGroup="/BLAdmins Jobs/Recommended Scheduled Jobs"

          blcli_execute JobGroup groupExists "${ParentGroup}"

          blcli_storeenv groupExists

          if [[ "${groupExists}" = "false" ]]

          then

             print "ERROR: What happened to $ParentGroup?"

             exit

          fi

          WorkGroup="${ParentGroup}/Work"

          blcli_execute JobGroup groupExists "${WorkGroup}"

          blcli_storeenv groupExists

           

          if [[ "${groupExists}" = "false" ]]

          then

            blcli_execute JobGroup createGroupWithParentName "Work" "${ParentGroup}"

            blcli_storeenv groupId

          fi

          1 of 1 people found this helpful
          • 2. Re: Trying to create BL folder in an nsh script. Fails with "Invalid qualified group name : Work"
            Kai Hintze

            Laughs! I knew it was something stupid I was looking right past. Re-reading the manual I see that swapping the order is precisely what I missed. Thanks!

             

            I was also looking at the performance commands today. I had seen blcli_execute in some samples I was trying to learn from, and saw the Performance Commands page when I was looking for the difference between blcli and blcli_execute. I'll go back to another script that runs but has blcli in a loop and see if I can't get that to work with blcli_execute. I'll probably post some questions about that tomorrow. (smile)

             

            Kai