GET VAR command behaves strangely

Help
Srini
2010-12-16
2013-06-12
  • Srini

    Srini - 2010-12-16

    Hi

    I have RHEL 4 with STAF 3.3.5 installed on it. When I invoke "staf local var list" I see set of variables, one of them is STAF/Config/OS/Name, When I try to retrieve this variable using GET VAR command of VAR service, I'm getting following errors in some cases (i.e when I use "local" as destination).

    Please guide me what is right way to use this. I suspect it to be some bug in VAR service's GET command. I also verified this with STAF 3.4.4. Following are results for both cases.

    # staf local misc version
    Response


    3.3.5

    # staf 10.112.72.101  var get  var  STAF/Config/OS/Name
    Response


    Linux

    # staf local  var get  var  STAF/Config/OS/Name
    Error submitting request, RC: 13

    # staf local  var get system  var  STAF/Config/OS/Name
    Response


    Linux

    # staf localhost  var get  var  STAF/Config/OS/Name
    Response


    Linux

    # hostname
    blr-3rd-1-dhcp101.eng.vmware.com

    # hostname -i
    10.xxx.xx.101   

    # staf local misc version
    Response


    3.4.4

    # staf 10.112.168.165  var get  var  STAF/Config/OS/Name
    Error submitting request, RC: 13
    Additional info


    This variable does not exist: STAF/Config/OS/Name

    # staf local  var get  var  STAF/Config/OS/Name
    Error submitting request, RC: 13
    Additional info


    This variable does not exist: STAF/Config/OS/Name

    # staf local  var get system  var  STAF/Config/OS/Name
    Response


    Linux

    # staf localhost  var get  var  STAF/Config/OS/Name
    Error submitting request, RC: 13
    Additional info


    This variable does not exist: STAF/Config/OS/Name

    # hostname
    blr-buildserver.eng.xyz.com

    # hostname -i
    10.XXX.XXX.165

     
  • David Michael Bender

    You almost never want to use the GET command.  When you use the GET command, only a specific variable pool is searched for the variable, which is why you are seeing these results.  Instead, you should use RESOLVE to retrieve the value of a variable (which will search in multiple variable pools).  For example:

    # STAF local VAR RESOLVE STRING {STAF/Config/OS/Name}
    Response
    --------
    Linux
    

    The STAF User's Guide has more information on the VAR GET and VAR RESOLVE requests, and the variable pools that are searched for these requests:  http://staf.sourceforge.net/current/STAFUG.htm#HDRVARSERVICE

     
  • Srini

    Srini - 2010-12-17

    Thanks David for the response. I tried using Resolve and it works for me.

    But I have a question here, Resolve will try to resolve Variables from System pool, shared pool and handle's pool. As you can see from my output when I use destination as IP address of localhost GET VAR works, but when I use loclalhost or local it does not work!, Is these pools recognized based on IP or hostname of the system ??
    Also, note the difference in their behavior in two different STAF versions.

     
  • David Michael Bender

    I'm not really sure why you are seeing the different behavior.  If I run the same commands on a RHEL 4 system with STAF 3.3.5, I don't see the same results as you:

    # STAF local MISC VERSION
    Response
    --------
    3.3.5
    # STAF local FS GET FILE /etc/redhat-release
    Response
    --------
    Red Hat Enterprise Linux AS release 4 (Nahant Update 8)
    # hostname -i
    9.x.xxx.204
    # STAF 9.x.xxx.204 VAR GET VAR STAF/Config/OS/Name
    Error submitting request, RC: 13
    # STAF local VAR GET VAR STAF/Config/OS/Name
    Error submitting request, RC: 13
    # STAF local VAR GET SYSTEM VAR STAF/Config/OS/Name
    Response
    --------
    Linux
    # STAF localhost VAR GET VAR STAF/Config/OS/Name
    Error submitting request, RC: 13
    

    So my results on STAF V3.3.5 are the same as your results on STAF V3.4.4.

     
  • Anonymous - 2012-11-29

    Hi, there still a problem somewhere. I got a similar issue as the orginal post.

    Both machines are on Windows 7 :

    local machine :

    C:\Users\user>staf 172.16.6.155 var get var STAF/Env/windir
    Error submitting request, RC: 13
    Additional info
    ---------------
    This variable does not exist: STAF/Env/windir
    

    distant machine :

    C:\Users\user1>staf 172.16.6.155 var GET VAR STAF/Env/windir
    Response
    --------
    C:\Windows
    

    STAF Version : 3.4.11

     
  • Sharon Lucas

    Sharon Lucas - 2012-11-29

    Why are you using the VAR service's GET request?  As stated in an earlier thread on this post, you almost never want to use the VAR service's GET command - use the VAR service's RESOLVE command instead.  This is also stated in section "8.21.3 GET" in the STAF User's Guide at http://staf.sourceforge.net/current/STAFUG.htm#HDRVARSERVICE.

    When you use the GET command and do not specify option SYSTEM, SHARED, or HANDLE, the value of the variable will be retrieved from the variable pool associated with the handle of the process that submitted the request unless the request came from another machine, in which case the variable will be retrieved from the system variable pool.  This explains why you are seeing different results when submitting the VAR GET request from the local system vs when submitting the VAR GET request via a remote system.

    Instead, you should use RESOLVE to retrieve the value of a variable (which will search in multiple variable pools).  For example:

    STAF local VAR RESOLVE STRING {STAF/Env/windir}

    The STAF User's Guide has more information on the VAR GET and VAR RESOLVE requests, and the variable pools that are searched for these requests:  http://staf.sourceforge.net/current/STAFUG.htm#HDRVARSERVICE

     

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks