Re: Create ACL from a string comparison to a file content

2013-05-01 Thread Maxime Ducharme
In fact we are reloading haproxy very often since we manage dynamic
backends instances based on an AWS EC2 cluster which shrinks and grows
according to load.

We manage the config file in puppet thats why we need some form of external
data source which wont be bound to puppet otherwise the agent will revert
any changes we do to it.

Once we change this value we will reload haproxy, and we need this value to
stay even in case there are other reloads while we put the
"maintenanceMode" switch to on, maybe there are better and easier solutions
for this.


2013/5/1 Willy Tarreau 

> Hi Maxime,
>
> On Wed, May 01, 2013 at 11:27:52AM -0400, Maxime Ducharme wrote:
> > Hello
> >
> > I am trying to create an ACL on 1.4 version where the criterion would be
> a
> > simple string but not sure it is possible.
> >
> > something similar to this :
> > acl maintenanceMode -f /etc/haproxy/maintenance.mode on
> > acl maintenanceMode on -f /etc/haproxy/maintenance.mode
> >
> > I'd like compare the string "on" from the content of a file without luck
> > yet, someone has an idea ?
>
> It does not do what you wrote unfortunately. Haproxy can load patterns from
> a file upon startup and append them to the other patterns declared on the
> same line. So basically "-f /etc/haproxy/maintenance.mode on" will match
> all patterns from maintenance.mode and "on" against whetever you use the
> ACL with.
>
> At the moment there is no way to fetch constant data to compare to
> patterns,
> though that can easily be done on 1.5. I think I can add some fetches to do
> that as well as for using environment variables.
>
> However you need to keep in mind that matching against patterns from files
> only happens once when you reload the config, so I'm not certain this is
> what you need.
>
> Willy
>
>


Re: Create ACL from a string comparison to a file content

2013-05-01 Thread Willy Tarreau
Hi Maxime,

On Wed, May 01, 2013 at 11:27:52AM -0400, Maxime Ducharme wrote:
> Hello
> 
> I am trying to create an ACL on 1.4 version where the criterion would be a
> simple string but not sure it is possible.
> 
> something similar to this :
> acl maintenanceMode -f /etc/haproxy/maintenance.mode on
> acl maintenanceMode on -f /etc/haproxy/maintenance.mode
> 
> I'd like compare the string "on" from the content of a file without luck
> yet, someone has an idea ?

It does not do what you wrote unfortunately. Haproxy can load patterns from
a file upon startup and append them to the other patterns declared on the
same line. So basically "-f /etc/haproxy/maintenance.mode on" will match
all patterns from maintenance.mode and "on" against whetever you use the
ACL with.

At the moment there is no way to fetch constant data to compare to patterns,
though that can easily be done on 1.5. I think I can add some fetches to do
that as well as for using environment variables.

However you need to keep in mind that matching against patterns from files
only happens once when you reload the config, so I'm not certain this is
what you need.

Willy




Create ACL from a string comparison to a file content

2013-05-01 Thread Maxime Ducharme
Hello

I am trying to create an ACL on 1.4 version where the criterion would be a
simple string but not sure it is possible.

something similar to this :
acl maintenanceMode -f /etc/haproxy/maintenance.mode on
acl maintenanceMode on -f /etc/haproxy/maintenance.mode

I'd like compare the string "on" from the content of a file without luck
yet, someone has an idea ?

Thanks