Forum Discussion
TCL & regex - help to parse APM configuration in tmsh
Hello World,
I'm using a script to bring some automation to APM and provision resources to my AP from an external server.
I'm stuck when comes the time to capture the macro name that I want to provision to the VPE.
In a full APM config dump I can get the full resource assign objects using a regex like:
apm policy policy-item AP_NAME-resources_assignment_act_full_resource_assign.+?caption "Dynamic Resource Assign"
(in the VPE I have my macro named Dynamic Resource Assign of course)
This returns me a string that contains (in my environment) 2 macros:
apm policy policy-item AP_NAME-resources_assignment_act_full_resource_assign {
agents {
AP_SAG_NAME-resources_assignment_act_full_resource_assign_ag {
type resource-assign
}
}
app-service none
caption "webtop Assign"
color 1
item-type action
loop false
macro none
partition Common
rules {
{
caption fallback
expression none
next-item AP_NAME-resources_assignment_act_empty_2
}
}
}
apm policy policy-item AP_NAME-resources_assignment_act_full_resource_assign_1 {
agents {
AP_NAME-resources_assignment_act_full_resource_assign_1_ag {
type resource-assign
}
}
app-service none
caption "Dynamic Resource Assign"
I'm stuck in finding the right regex to capture the macro name of the second occurrence (AP_NAME-resources_assignment_act_full_resource_assign_1_ag).
I tried:
AP_SAG_E11TST-resources_assignment_act_full_resource_assign.?.?_ag
but of course it returns two entries:
AP_SAG_NAME-resources_assignment_act_full_resource_assign_ag
AP_SAG_NAME-resources_assignment_act_full_resource_assign_1_ag
If anyone has a clue on how to filter out the caption "webtop Assign" entry or (better) make sure only the caption "Dynamic Resource Assign" one is returned that would help me quite a lot...
Thank you all!
Jérôme
Recent Discussions
Related Content
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com