Symantec Access Management

Expand all | Collapse all

Help with agent name in realm in perl CLI..

  • 1.  Help with agent name in realm in perl CLI..

    Posted 12-10-2009 01:00 PM
    Kind Siteminder folks,    I was trying to print out some things for a realm, one of them is  the agent name field.      In the realm in the GUI the agent field in a realm can be either a single agent  or an agent Group Name.  In the perl CLI    it seems I can retrieve and print out the agent field for a realm when it is a single agent name;   ie.   webagent1.This works fine printing the agent name.    But when the agent field for the realm contains an agentgroup name  my print fails   ie..     Mywebagentgroup1    My code looks like the following;  ## Loop thru realms for this domain...
                  @realms=$domain->GetAllRealms();              foreach $realm(@realms) {
                                  $ascheme=$realm->AuthScheme();
                                  $agent=$realm->Agent();                              ### Print out things from the realm....
                                  print DEST "\n Realm," . $realm->Name() . "," . $realm->ResourceFilter() . "," . $realm->ProtectResource() . "," . $r
    ealm->Description() . "," . $agent->Name() . "," . $ascheme->Name() . ","   . $ascheme->CustomParam();
                  }    I'm thinking when a realm contains an agentgroup instead of a single agent     the $realm->Agent()   may be returning an object of the agent group type?It errors with;    Can't call method "Name" on an undefined value at ./my_realm_script.pl line 60   (60 is the print statement above).    Any help on the perl CLI and the data types would be great.    Sorry if it's something obvious..   I'm thinking I need an if statement and if it isan agentgroup I need to break out the name differently?  Thanks.  rminnj


  • 2.  RE: Help with agent name in realm in perl CLI..

    Posted 06-24-2010 05:17 PM
    I'd like to bump this thread.

    The Perl API docs for a realm (PolicyMgtRealm) specifically say it has a method called
    Agent() that retrieves the agent for a realm. My code works if a single agent is
    configured for the realm. But if there is an agent Group configured for the realm
    then the $realm->Agent() API returns nothing. How does one retrieve an agentgroup
    name for the realm if the only method available is agent() ??


  • 3.  RE: Help with agent name in realm in perl CLI..

    Posted 06-28-2010 04:37 PM
    I have the same exact question. Anyone?

    Thanks.


  • 4.  RE: Help with agent name in realm in perl CLI..

    Posted 06-30-2010 10:23 AM
    It is a while since I did some work with the Perl API, I would suggest checking the exclusions as you may find that the API does not deal with groups (agent or response) - it certainly didn't when I was programming a couple of years ago.


  • 5.  Remember the Docs!

    Posted 07-01-2010 01:46 PM
      |   view attached
    please see page 266 of the pdf attached.
    you will notice that agents and agent groups are different things.

    please let me know if this is useful.
    if you really need a new method, you could open a case to get the Perl CLI enhanced.

    -Josh

    Attachment(s)

    pdf
    SDK-Perl.pdf   3.59MB 1 version


  • 6.  RE: Remember the Docs!

    Posted 07-06-2010 10:36 AM
    I think most of us are aware of the differences between an Agent and Agent Group. The question is how do you retrieve the Agent Group that is mapped to a realm using the Perl API? As stated previously, the $realm->Agent() method seems to only work for an Agent and not an Agent Group.


  • 7.  RE: Remember the Docs!

    Posted 08-24-2010 02:25 PM

    Josh_Perlmutter wrote:

    please see page 266 of the pdf attached.
    you will notice that agents and agent groups are different things.

    please let me know if this is useful.
    if you really need a new method, you could open a case to get the Perl CLI enhanced.

    -Josh
    Thanks so much.
    I think the perl cli needs to be enhanced then. The agent field for a realm can be
    an agent or and agent group. If method fails on groups I need something to get the group
    name. If I simply need different perl code to and an if statement to deal with a group
    name I'd like to know. But, as you said, I think the method is limited to a single
    agent name only. This seems a big limit...almost like the method can return a single
    scalar variable but not an array.


  • 8.  Re: Help with agent name in realm in perl CLI..

    Posted 10-16-2017 12:05 PM

    Hello Siteminder Gems,

         Has this ever been resolve? I still cannot print the Agent Group name of a realm in a policy domain. Please help if there is any indirect way to print it



  • 9.  Re: Help with agent name in realm in perl CLI..

    Broadcom Employee
    Posted 10-16-2017 09:18 PM

    Hi, 

     

    I have answered your question here:

     

    Perl API: Returning Agent Group name from Realm  

     

    Thanks, Simon.



  • 10.  Re: Help with agent name in realm in perl CLI..

    Posted 10-16-2017 11:42 PM

    Thanks Simon for the code snippet. I tried and I am getting the following error though I have the Agent Group for the resource filter.

     

    ERROR - Can't call method "Name" on an undefined value at ./test.pl line 12.

     

    I am using Siteminder R12.52.



  • 11.  Re: Help with agent name in realm in perl CLI..

    Broadcom Employee
    Posted 10-17-2017 12:51 AM

    I'm confused by this:

     

    "I have the Agent Group for the resource filter."

     

    The Agent Group should be in the Agent field, not the Resource Filter field.



  • 12.  Re: Help with agent name in realm in perl CLI..

    Posted 10-17-2017 09:51 AM

    My Bad Simon. Let me be more clear here.

     

    Code Snippet given by you:

    use Netegrity::PolicyMgtAPI;
    use Scalar::Util qw(blessed);

    $policyapi = Netegrity::PolicyMgtAPI->New();
    $session = $policyapi->CreateSession("siteminder", "siteminderadmin");
    die "\nFATAL: Cannot create session. Please check admin credentials\n" unless ($session != undef);
    $domain = $session->GetDomain("DA");
    print $domain->Name(), "->";
    $realm = $domain->GetRealm("DA Public");
    print $realm->Name(), "->";
    $agent = $realm->Agent();
    print $agent->Name(), " Type=";
    print blessed($agent);

     

    Response:

    ERROR - Can't call method "Name" on an undefined value at ./test.pl line 12.

     

    But I do have the Agent Group "DA Agent Group" defined for the Realm I am trying to retrieve.

    The Value for $agent->Name() is returning as "undef" though I have value. Can you please help?

     

    Thanks

    Gopi Krishna

     



  • 13.  RE: Re: Help with agent name in realm in perl CLI..

    Posted 02-23-2020 09:47 PM
    Any Inputs on this query ? This has been broken since years now... Do we have any updated CLI or perl library on R12.52 to fix this?