How to ensure only specific instances exist?

Dan Morphis dan at milkcarton.com
Fri Jun 16 19:29:05 EDT 2017


Perfect, that is exactly what I needed!

On Fri, Jun 16, 2017 at 3:18 PM, Zaid Abdulla <zaid at genieacs.com> wrote:

> On Thu, 2017-06-15 at 09:41 -0800, Dan Morphis wrote:
> > We are adding the ability for customers to manage port forwarding
> > (PortMapping). I'm trying to figure out how to ensure that only
> > specific instances exist in the PortMapping node. For instance
> > customer adds a port forward for
> > ExternalPort:3000,InternalPort:3001,PortMappingProtocol:TCP,InternalC
> > lient:192.168.1.50. Creating that instance will be easy enough.
> >
> > Now, the customer remove that instance, and adds a mapping for
> > ExternalPort:8080,InternalPort:80,PortMappingProtocol:TCP,InternalCli
> > ent:192.168.1.51,
> > ExternalPort:8081,InternalPort:80,PortMappingProtocol:TCP,InternalCli
> > ent:192.168.1.50. How can I using provisioning scripts ensure that
> > the first instance is deleted, and the second instance is created, if
> > the only data I have available is what the desired state should be?
>
> If I understand you correctly, you can do something like this:
>
> declare("InternetGatewayDevice.WANDevice.*.WANConnectionDevice.1.WANPPP
> Connection.*.PortMapping.[]", null, {path: 0});
>
> declare("InternetGatewayDevice.WANDevice.*.WANConnectionDevice.1.WANPPP
> Connection.*.PortMapping.[ExternalPort:8080,InternalPort:80,PortMapping
> Protocol:TCP,InternalClient:192.168.1.51]", {path: 1}, {path: 1});
>
> declare("InternetGatewayDevice.WANDevice.*.WANConnectionDevice.1.WANPPP
> Connection.*.PortMapping.[ExternalPort:8081,InternalPort:80,PortMapping
> Protocol:TCP,InternalClient:192.168.1.50]", {path: 1}, {path: 1});
>
> This will cause all instances other than those two to be deleted. And
> since there's no commit() between the declarations, it knows not to
> delete and recreate said instances.
>
> --
> Zaid Abdulla <zaid at genieacs.com>
> _______________________________________________
> Users mailing list
> Users at lists.genieacs.com
> http://lists.genieacs.com/mailman/listinfo/users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.genieacs.com/pipermail/users/attachments/20170616/10ba403f/attachment-0001.html>


More information about the Users mailing list