Environment variable in provisioning script

Dan Morphis dan at milkcarton.com
Wed May 17 23:36:02 EDT 2017


I have a two fold issue. The first, in production we have a CPE that doesn't automatically add a static route to the ACS (all of our others do this automatically, well more technically they CPEs automatically add a static route to the DHCP server, which happens to be on the same server as the acs). So after the CPE turns up the ppp connection the CPE looses connectivity with the acs.

I've solved this by automatically adding a static when the CPE first connects. Because of a legacy issue the server the acs lives on has two IPs, a 172.24.x.x ip, and a public ip. The cpes only do management on the 172 ip.

Our dev server only has a 172 ip.

So the provisioning script that adds the static route calls an external script which then figures out the IPv4, non loopback ips and returns them to the provisioning script. In dev, this works perfectly because the only ip that's returned is the 172 ip.

When we switched over to v1.1 last week, the extension script returned two ips, the public and private. I quickly caught the issue and hard coded the script to use the private ip.

Fast forward to this week. I have some code which syncs the scripts between dev and prod. After I synced the scripts from prod to dev, all my dev modems stopped responding because the static route that was being added was for the production server.

I've worked around this for now by changing my provisioning script to:
let serverIp = ips.find(ip => ip.startsWith('172'));

Make sense?

-dan

> On May 17, 2017, at 6:42 PM, Zaid Abdulla <zaid at genieacs.com> wrote:
> 
>> On Wed, 2017-05-17 at 14:16 -0800, Dan Morphis wrote:
>> Is there anyway to get an environment variable in a provisioning
>> script?
> 
> No, but you can use extension scripts to read environment variables but
> I think that would be overkill. Why do you need to do this if I may
> ask? I'm planning a feature where you can define a set of variables and
> reference them from scripts and presets, so that may be what you're
> looking for.
> 
> -- 
> Zaid Abdulla <zaid at genieacs.com>
> _______________________________________________
> Users mailing list
> Users at lists.genieacs.com
> http://lists.genieacs.com/mailman/listinfo/users


More information about the Users mailing list