cdist-web/src/extra/manual/3.1.11/man7/cdist-type__key_value.html

68 lines
6.1 KiB
HTML
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>cdist-type__key_value(7)</title><link rel="stylesheet" type="text/css" href="docbook-xsl.css" /><meta name="generator" content="DocBook XSL Stylesheets V1.78.1" /></head><body><div xml:lang="en" class="article" lang="en"><div class="titlepage"><div><div><h2 class="title"><a id="idm140577151230352"></a>cdist-type__key_value(7)</h2></div><div><div class="author"><h3 class="author"><span class="firstname">Steven</span> <span class="surname">Armstrong</span></h3><code class="email">&lt;<a class="email" href="mailto:steven-cdist--@--armstrong.cc">steven-cdist--@--armstrong.cc</a>&gt;</code></div></div></div><hr /></div><div class="toc"><p><strong>Table of Contents</strong></p><dl class="toc"><dt><span class="section"><a href="#_name">1. NAME</a></span></dt><dt><span class="section"><a href="#_description">2. DESCRIPTION</a></span></dt><dt><span class="section"><a href="#_required_parameters">3. REQUIRED PARAMETERS</a></span></dt><dt><span class="section"><a href="#_optional_parameters">4. OPTIONAL PARAMETERS</a></span></dt><dt><span class="section"><a href="#_boolean_parameters">5. BOOLEAN PARAMETERS</a></span></dt><dt><span class="section"><a href="#_messages">6. MESSAGES</a></span></dt><dt><span class="section"><a href="#_examples">7. EXAMPLES</a></span></dt><dt><span class="section"><a href="#_more_information">8. MORE INFORMATION</a></span></dt><dt><span class="section"><a href="#_see_also">9. SEE ALSO</a></span></dt><dt><span class="section"><a href="#_copying">10. COPYING</a></span></dt></dl></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="_name"></a>1. NAME</h2></div></div></div><p>cdist-type__key_value - Change property values in files</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="_description"></a>2. DESCRIPTION</h2></div></div></div><p>This cdist type allows you to change values in a key value based config
file.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="_required_parameters"></a>3. REQUIRED PARAMETERS</h2></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term">
file
</span></dt><dd>
The file to operate on.
</dd><dt><span class="term">
delimiter
</span></dt><dd>
The delimiter which seperates the key from the value.
</dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="_optional_parameters"></a>4. OPTIONAL PARAMETERS</h2></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term">
state
</span></dt><dd>
present or absent, defaults to present. If present, sets the key to value,
if absent, removes the key from the file.
</dd><dt><span class="term">
key
</span></dt><dd>
The key to change. Defaults to object_id.
</dd><dt><span class="term">
value
</span></dt><dd>
The value for the key. Optional if state=absent, required otherwise.
</dd><dt><span class="term">
comment
</span></dt><dd>
If supplied, the value will be inserted before the line with the key,
but only if the key or value must be changed.
You need to ensure yourself that the line is prefixed with the correct
comment sign. (for example # or ; or wathever ..)
</dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="_boolean_parameters"></a>5. BOOLEAN PARAMETERS</h2></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term">
exact_delimiter
</span></dt><dd>
If supplied, treat additional whitespaces between key, delimiter and value
as wrong value.
</dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="_messages"></a>6. MESSAGES</h2></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term">
remove
</span></dt><dd>
Removed existing key and value
</dd><dt><span class="term">
insert
</span></dt><dd>
Added key and value
</dd><dt><span class="term">
change
</span></dt><dd>
Changed value of existing key
</dd><dt><span class="term">
create
</span></dt><dd>
A new line was inserted in a new file
</dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="_examples"></a>7. EXAMPLES</h2></div></div></div><pre class="screen"># Set the maximum system user id
__key_value SYS_UID_MAX --file /etc/login.defs --value 666 --delimiter ' '
# Same with fancy id
__key_value my-fancy-id --file /etc/login.defs --key SYS_UID_MAX --value 666 \
--delimiter ' '
# Enable packet forwarding
__key_value net.ipv4.ip_forward --file /etc/sysctl.conf --value 1 \
--delimiter ' = ' --comment '# my linux kernel should act as a router'
# Remove existing key/value
__key_value LEGACY_KEY --file /etc/somefile --state absent --delimiter '='</pre></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="_more_information"></a>8. MORE INFORMATION</h2></div></div></div><p>This type try to handle as many values as possible, so it doesnt use regexes.
So you need to exactly specify the key and delimiter. Delimiter can be of any lenght.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="_see_also"></a>9. SEE ALSO</h2></div></div></div><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">
<a href="../man7/cdist-type.html">cdist-type(7)</a>
</li></ul></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="_copying"></a>10. COPYING</h2></div></div></div><p>Copyright (C) 2011 Steven Armstrong. Free use of this software is
granted under the terms of the GNU General Public License version 3 (GPLv3).</p></div></div></body></html>