2 Replies Latest reply on Nov 24, 2014 8:48 AM by Jorge Lavín

    Component key via blcli to add a component exception

      Hi all

       

      I'm looking for the easiest way to add a component exception to a component, and for that I need its DBKey. In the end, what I want is

       

      ComponentException createComponentExceptionWithOneRule $componentKey$ $Name$ $Description$ $Role$ $User$ $Comment$ $templateGroupName$ $templateName$ $ruleName$
      

       

      What I do now is


      Get template key by group and name - tkey

      Find the rule to add the exception to

      Get the id of the server

      Get all components of a template by by template key and server id

      Iterate all components and check them converting key to name
      Once that the component is found, create the component exception

       

       

      Is there a faster or more direct way to do this?


      Thanks

        • 1. Re: Component key via blcli to add a component exception
          Bill Robinson

          you said you are iterating over all the components - that is all of the components for that template on this server ?  like 'Component getAllComponentKeysByTemplateKeyAndServerId' ?  how many components do you have per server for your template?  and how do you know which one to set the exception on ?

          • 2. Re: Re: Component key via blcli to add a component exception

            Hi Bill:

            you said you are iterating over all the components - that is all of the components for that template on this server ?  like 'Component getAllComponentKeysByTemplateKeyAndServerId' ?

            Correct

             

            how many components do you have per server for your template?

            Not a fixed number, may it be more than one

             

            how do you know which one to set the exception on

            I know the name of the component to add the exception to, then

             

            for component in all_components_by_tkey_and_server_id:
               if component == component_to_except:
                   component.add_exception(exception_rule_arguments)