Revision 5c2c605b
Added by Nicolas CHARLES over 6 years ago
maintained-techniques | ||
---|---|---|
fileDistribution/downloadFile/2.0
|
||
fileDistribution/downloadFile/3.0
|
||
fileDistribution/manageKeyValueFile/1.0
|
||
fileDistribution/manageKeyValueFile/1.1
|
||
jobScheduling/jobScheduler/1.0
|
||
jobScheduling/jobScheduler/2.0
|
||
system/common/1.0
|
techniques/fileDistribution/manageKeyValueFile/1.0/metadata.xml | ||
---|---|---|
|
||
<!-- This technique lets user define a key-value in a file -->
|
||
<TECHNIQUE name="Manage keys-values in file">
|
||
<DEPRECATED>This technique version has been superseded by a new version. It will no longer be available in the next stable version of Rudder. Please upgrade to the latest version.</DEPRECATED>
|
||
<DESCRIPTION>Manage keys-values in file</DESCRIPTION>
|
||
<MULTIINSTANCE>true</MULTIINSTANCE>
|
||
<COMPATIBLE>
|
techniques/fileDistribution/manageKeyValueFile/1.1/changelog | ||
---|---|---|
-- Nicolas Charles <nicolas.charles@normation.com> Tue Sep 12 18:45:08 2017
|
||
* Version 1.1
|
||
** Add an option to be strict on spaces around separator
|
techniques/fileDistribution/manageKeyValueFile/1.1/manage-key-value-file.st | ||
---|---|---|
#####################################################################################
|
||
# Copyright 2016 Normation SAS
|
||
#####################################################################################
|
||
#
|
||
# This program is free software: you can redistribute it and/or modify
|
||
# it under the terms of the GNU General Public License as published by
|
||
# the Free Software Foundation, Version 3.
|
||
#
|
||
# This program is distributed in the hope that it will be useful,
|
||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
# GNU General Public License for more details.
|
||
#
|
||
# You should have received a copy of the GNU General Public License
|
||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||
#
|
||
#####################################################################################
|
||
|
||
bundle agent manage_key_value_file {
|
||
vars:
|
||
&MANAGE_KEY_VALUE_FILEPATH:{file | "file[&i&]" string => "&file&";
|
||
}&
|
||
&MANAGE_KEY_VALUE_KEY:{key | "key[&i&]" string => "&key&";
|
||
}&
|
||
&MANAGE_KEY_VALUE_VALUE:{value | "value[&i&]" string => "&value&";
|
||
}&
|
||
&MANAGE_KEY_VALUE_SEPARATOR:{separator | "separator[&i&]" string => "&separator&";
|
||
}&
|
||
&TRACKINGKEY:{uuid | "trackingkey[&i&]" string => "&uuid&";
|
||
}&
|
||
|
||
|
||
"index" slist => getindices("file");
|
||
|
||
"canonified_file[${index}]" string => canonify("${file[${index}]}");
|
||
"class_prefix_${index}" string => "file_ensure_key_value_${canonified_file[${index}]}";
|
||
"technique_name" string => "Manage keys-values file";
|
||
methods:
|
||
"apply_${index}" usebundle => file_ensure_key_value("${file[${index}]}", "${key[${index}]}", "${value[${index}]}", "${separator[${index}]}");
|
||
"report_${index}" usebundle => rudder_common_reports_generic_index("${technique_name}", "${class_prefix_${index}}", "${trackingkey[${index}]}", "File", "${file[${index}]}", "The key -> value ${key[${index}]} ${separator[${index}]} ${value[${index}]}", "${index}");
|
||
|
||
}
|
techniques/fileDistribution/manageKeyValueFile/1.1/metadata.xml | ||
---|---|---|
<!--
|
||
Copyright 2015 Normation SAS
|
||
|
||
This program is free software: you can redistribute it and/or modify
|
||
it under the terms of the GNU General Public License as published by
|
||
the Free Software Foundation, Version 3.
|
||
|
||
This program is distributed in the hope that it will be useful,
|
||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
GNU General Public License for more details.
|
||
|
||
You should have received a copy of the GNU General Public License
|
||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||
-->
|
||
|
||
<!-- This technique lets user define a key-value in a file -->
|
||
<TECHNIQUE name="Manage keys-values in file">
|
||
<DESCRIPTION>Manage keys-values in file</DESCRIPTION>
|
||
<MULTIINSTANCE>true</MULTIINSTANCE>
|
||
<COMPATIBLE>
|
||
<OS>Every OS</OS>
|
||
<AGENT version=">= 3.5">cfengine-community</AGENT>
|
||
</COMPATIBLE>
|
||
|
||
<BUNDLES>
|
||
<NAME>manage_key_value_file</NAME>
|
||
</BUNDLES>
|
||
|
||
<TMLS>
|
||
<TML name="manage-key-value-file"/>
|
||
</TMLS>
|
||
|
||
<TRACKINGVARIABLE>
|
||
<SAMESIZEAS>MANAGE_KEY_VALUE_FILEPATH</SAMESIZEAS>
|
||
</TRACKINGVARIABLE>
|
||
|
||
<SECTIONS>
|
||
<SECTION name="File to manage" multivalued="true" >
|
||
<SECTION name="File" component="true" componentKey="MANAGE_KEY_VALUE_FILEPATH">
|
||
<INPUT>
|
||
<NAME>MANAGE_KEY_VALUE_FILEPATH</NAME>
|
||
<DESCRIPTION>Path of the file to manage</DESCRIPTION>
|
||
</INPUT>
|
||
<INPUT>
|
||
<NAME>MANAGE_KEY_VALUE_KEY</NAME>
|
||
<DESCRIPTION>Key to define</DESCRIPTION>
|
||
<CONSTRAINT>
|
||
<TYPE>string</TYPE>
|
||
</CONSTRAINT>
|
||
</INPUT>
|
||
<INPUT>
|
||
<NAME>MANAGE_KEY_VALUE_VALUE</NAME>
|
||
<DESCRIPTION>Value to define</DESCRIPTION>
|
||
<CONSTRAINT>
|
||
<TYPE>string</TYPE>
|
||
<MAYBEEMPTY>true</MAYBEEMPTY>
|
||
</CONSTRAINT>
|
||
</INPUT>
|
||
<INPUT>
|
||
<NAME>MANAGE_KEY_VALUE_SEPARATOR</NAME>
|
||
<DESCRIPTION>Separator between key and value (for example "=")</DESCRIPTION>
|
||
<LONGDESCRIPTION>If you need to use space as a separator, you should use ${ncf_const.s} value.</LONGDESCRIPTION>
|
||
<CONSTRAINT>
|
||
<TYPE>string</TYPE>
|
||
</CONSTRAINT>
|
||
</INPUT>
|
||
</SECTION>
|
||
</SECTION>
|
||
</SECTIONS>
|
||
</TECHNIQUE>
|
Also available in: Unified diff
Refs #11087: Creation of manageKeyValueFile version 1.1 from 1.0