3 Replies Latest reply on Sep 30, 2014 2:43 PM by R V

    Certain server properties are empty if got per blcli from Smart Group

    Carl Burger

      Hi,

       

      i've written a jython script to get specified properties from all servers of a static group or smart group via the blcli calls getGroupByQualifiedName and findAllByServerGroup. The script iterates through the resulting list and gets the wanted properties. My problem is I'm getting empty values for the properties USER_CREATED, USER_MODIFIED, ROLE_CREATED and ROLE_MODIFIED only if I get the servers from a smart group. If I get the servers from a static group everything is fine. I could make a single blcli call for everyone of these cases but it would slow down the script considerably as there are often several thousand servers in these groups. Is there any workaround, is this a bug? I'm thinking about adding all servers to a temporary static group but I'm hoping for a more elegant solution.

       

      cheers,

      Carl

        • 2. Re: Certain server properties are empty if got per blcli from Smart Group
          Carl Burger

          The important parts are:

           

          dictServerProperties={}
              if groupName:
                  print "Getting servers from group '%s'..." % groupName,
                  try:
                      groupObject = blcliCall("ServerGroup","getGroupByQualifiedName",groupName)
                      groupServerList = blcliCall("Server","findAllByServerGroup",groupObject.groupId,True)
                  except:
                      print "Failed"
                      os._exit(2)
                  print "Success, got %d Servers" % groupServerList.list.__len__()
              else:
                  print "No group specified, exiting script..."
                  os._exit(2)
          
          

           

           

          and:

           

              while True:
                  if groupServerList.list.__len__() <= 0:
                      break
                  else:
                      curServer = groupServerList.list.remove(0)
                
                  strServerName = curServer.name
                  dictServerProperties[strServerName]={}
                  for Property in propertyList.split(","):
                      try:
                          if curServer.getValueByPropertyString(Property).getType() < 6000:
                              strPropertyValue = curServer.getValueByPropertyString(Property).getName()
                          else:
                              strPropertyValue = curServer.getValueByPropertyString(Property).toString()
                      except:
                          print "Failed getting property '%s'. Exiting script." % Property
                          os._exit(3)
                      dictServerProperties[strServerName][Property] = strPropertyValue
                  print "\rGetting properties, %d servers left" % groupServerList.list.__len__(),
                  sys.stdout.flush()
          
          

           

           

          cheers,

          Carl

          • 3. Re: Certain server properties are empty if got per blcli from Smart Group
            R V

            HI Carl,

            ok, this is six month old - but have you ever got a solution, maybe an answer from support for this "behaviour"?

            Some questions about your script:

            - in line 09 (2nd script): where/how is "propertyList" filled?

            - where do the empty values appear: in lines 12/14 of the 2nd script?

             

            If it's still open - could you post some working script so I can check it easily?

             

            Best regards,

            Reinhard