getbundlemetatags
Table of contents
Prototype: getbundlemetatags(bundlename, optional_tag)
Return type: slist
Description: Returns the list of meta
tags for bundle bundlename
.
Arguments:
bundlename
:string
- Variable identifier - in the range:[a-zA-Z0-9_$(){}\[\].:]+
The optional_tag
can be used to look up a specific tag's value.
If you have:
code
bundle agent example
{
meta:
"tags"
slist => {
"mykey=myvalue1",
"mykey=myvalue2",
"yourkey=yourvalue1",
};
}
then getbundlemetatags( "example", "mykey" )
will return a list with two entries, { "myvalue1",
"myvalue2" }
.
Example:
code
body common control
{
bundlesequence => { "example" };
}
bundle agent example
{
meta:
"tags"
slist => {
"autorun",
"myOtherTag",
"contact=Some Person <some.person@northern.tech>",
};
vars:
"bundle_tags"
slist => getbundlemetatags("default:example");
"contact_tag"
slist => getbundlemetatags("default:example", "contact");
reports:
"Found tags: $(bundle_tags)";
"Contact tag: $(contact_tag)";
}
Output:
code
R: Found tags: autorun
R: Found tags: myOtherTag
R: Found tags: contact=Some Person <some.person@northern.tech>
R: Contact tag: Some Person <some.person@northern.tech>
Notes:
See also: getvariablemetatags()
, getclassmetatags()
History:
- Function added in 3.26.0.