Hello,

I have rule that creates context if software deploy is started. The json
message also consists user variable which I like to pass on to second rule
that do not have this user in the pattern. Tried multiple solutions but
unfortunately I was unable to do that.

* First rule creates context DEPLOY_STARTED_myservice. And I want to pass
$+{user} variable to other rule. I tried to pass this argument with "assign
%user $+{user}" but this raises problem that if the same time other deploy
is started then this user variable is overwritten and second rule gets
wrong username.
type=Single
ptype=PerlFunc
pattern=sub { if ($_[0] =~ /({.+\"status\":\"started\".+})/) { \
              return SecJson::json2matchvar($1); } return 0; }
context=!DEPLOY_STARTED_$+{service}
continue=TakeNext
desc=Started deploy of service $+{service} by user $+{user}
action=create DEPLOY_STARTED_$+{service} 1800

* Second rule waits that context DEPLOY_STARTED_myservice is created and I
need to pass user parameter to this rule. User do not exists on the pattern.
type=Single
ptype=PerlFunc
pattern=sub { if ($_[0] =~ /({ .+\"message":\".+\",
\"service_name\":\".+\", \"region\":\".+\" })/) { \
              return SecJson::json2matchvar($1); } return 0; }
context=DEPLOY_STARTED_$+{service}
continue=TakeNext
desc=Container was killed by service
action=write $+{service_name}_$+{region}_$+{user};

Regards,
Andres
_______________________________________________
Simple-evcorr-users mailing list
Simple-evcorr-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/simple-evcorr-users

Reply via email to