4 Replies Latest reply on Nov 2, 2013 11:11 AM by Vikas Sharma

    blcli command to apply ACL Policy to a server smart group

    Kate Fell

      Is there a blcli command to apply ACL Policy to a server smart group? I can find commands for server groups but nothing for smart groups.

        • 1. Re: blcli command to apply ACL Policy to a server smart group

          Search for the below command in BLCLI help. For server smart group, the modeltype value is 5007.

          Group:applyAclPolicy

           

          Eg:

          cmd = ["Group","applyAclPolicy","/testSmartGroup",5007,"testPolicy"]

          jli.run(cmd)

           

          Once the BLCLI connection is established, the above example will set the ACL policy "testPolicy" to server smart group "testSmartGroup" under "Servers" object.

          • 2. Re: blcli command to apply ACL Policy to a server smart group
            Kate Fell

            Hi,

             

            I have tried the below and get this error...

             

            blcli_execute ServerGroup applyAclPolicy "/Management/All" 5007 "BLAdmin"

             

            +./testSG.nsh:3> blcli_setoption authType BLSSO

            +./testSG.nsh:4> blcli_setoption roleName BLAdmins

            +./testSG.nsh:5> blcli_setoption serviceProfileName default

            +./testSG.nsh:8> blcli_execute ServerGroup applyAclPolicy /Management/All,5007,

            BLAdmin

            Command links should not refer to default command ids : Group.addPermissionToGro

            up-DEFAULT-8588

            Command execution failed. com.bladelogic.om.infra.mfw.util.NotFoundException: Co

            uld not find group with name : /Management/All,5007, and type : 5003: com.bladel

            ogic.om.infra.mfw.util.NotFoundException: Could not find child group by name : A

            ll,5007, with parent of type : 1 and id : 2005400

             

            Then tried this:

             

            blcli_execute ServerGroup applyAclPolicy "/Management/All" "5007" "BLAdmin"

             

            +./testSG.nsh:3> blcli_setoption authType BLSSO

            +./testSG.nsh:4> blcli_setoption roleName BLAdmins

            +./testSG.nsh:5> blcli_setoption serviceProfileName default

            +./testSG.nsh:8> blcli_execute ServerGroup applyAclPolicy /Management/All 5007 B

            LAdmin

            Command execution failed. com.bladelogic.om.infra.cli.factory.CommandNotFoundExc

            eption: Found command 'ServerGroup.applyAclPolicy' but with mismatching argument

            s. : java.lang.IllegalArgumentException: Wrong number of arguments provided to m

            ethod : applyAclPolicy expected : 2 received : 3

             

            Can you please let me know where I am going wrong?

            • 3. Re: Re: blcli command to apply ACL Policy to a server smart group
              Jim Wilson

              It's not an answer as such (hopefully someone else may be able to provide that), but from the BMC Server Automation Command Line Interface 8.3 documentation:

               

              76.2.1 ServerGroup - applyAclPolicy

              76.2.2 Description :

              This command applies an ACL policy to a Server Group.

              This command works only on static server groups.

               

              https://docs.bmc.com/docs/display/bsacli83/ServerGroup+-+applyAclPolicy

              • 4. Re: blcli command to apply ACL Policy to a server smart group

                Jim is right that applyAclPolicy works only on static server groups. In fact, you won't find any command related to this for any smart group types (Depot, Job, Servers etc). I would suggest you to search BLCLI help with keyword "Group", in the results look for "Group : applyAclPolicy" and "Group : addPermission".

                 

                Instead of:

                blcli_execute ServerGroup applyAclPolicy /Management/All,5007

                 

                use:

                blcli_execute Group applyAclPolicy <server_smart_group> 5007 <policy_name>


                eg:

                blcli_execute Group applyAclPolicy /test1/test2 5007 Pol-Acl-Unix


                where

                test2 is the smart server group under test1 server group,

                5007 is the model type value for server smart group,

                Pol-Acl-Unix is the policy that needs to be applied