Tom Eastep | 21 Feb 22:38 2012
Picon

Re: remote execute hook prior to evaluating params

On 02/21/2012 01:23 PM, Brian J. Murrell wrote:
> Currently I have in my params:
> 
> CGCOIF=$(ssh root <at> gw "/sbin/uci -p /var/state get network.wan0.ifname")
> IGSIF=$(ssh root <at> gw "/sbin/uci -p /var/state get network.wan1.ifname")
> PPPEIF=$(ssh root <at> gw "/sbin/uci -p /var/state get network.pppoe_ether.device")
> CGCO_GATEWAY=$(ssh root <at> gw "/sbin/uci -p /var/state get network.wan0.gateway")
> IGS_GATEWAY=$(ssh root <at> gw "/sbin/uci -p /var/state get network.wan1.gateway")
> IGS_ADDRESS=$(ssh root <at> gw "/sbin/uci -p /var/state get network.wan1.ipaddr")
> 
> Which is a whole lotta round trips all requiring their own crypto
> authentication, etc.
> 
> I wonder if there is an available hook that I could use to go fetch
> all of that in a single round-trip (i.e. and store it locally and then
> source that local file for the values).
> 
> I suppose if params is just sourced and executed sh script I could just
> do the single execution and use the result.  I'm not sure that it is though.
> 
> Thoughts?

I guess my first question is "How are you using these variables?". In
configuration files, the first three can be replaced by "Runtime Address
Variables"; see
http://www.shorewall.net/configuration_file_basics.htm#Variables.

Shorewall will detect the gateway addresses for you and store them in
shell variables in the generated script, but so far I haven't
implemented gateway Runtime Address Variables, though. Not hard to do,
though...

The params file is process by ${LIBEXEC}/shorewall/getparams which
simply sources it using '.' (assuming that EXPORT_PARAMS=No).

-Tom
-- 
Tom Eastep        \ When I die, I want to go like my Grandfather who
Shoreline,         \ died peacefully in his sleep. Not screaming like
Washington, USA     \ all of the passengers in his car
http://shorewall.net \________________________________________________

------------------------------------------------------------------------------
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d
------------------------------------------------------------------------------
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d

Gmane