Add type __cdistmarker.
This commit is contained in:
parent
33763b72dd
commit
dbf0767c4e
4 changed files with 94 additions and 0 deletions
37
conf/type/__cdistmarker/gencode-remote
Executable file
37
conf/type/__cdistmarker/gencode-remote
Executable file
|
@ -0,0 +1,37 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# Copyright (C) 2011 Daniel Maher (phrawzty+cdist at gmail.com)
|
||||
#
|
||||
# This file is part of cdist (https://github.com/telmich/cdist/).
|
||||
#
|
||||
# cdist 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, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# cdist 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 cdist. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
# The marker file is established in the docs, but it isn't obligatory.
|
||||
if [ -f "$__object/parameter/destination" ]; then
|
||||
destination="$(cat "$__object/parameter/destination")"
|
||||
else
|
||||
destination='/etc/cdist-configured'
|
||||
fi
|
||||
|
||||
# The basic output of date is usually good enough, but variety is the
|
||||
# spice of life...
|
||||
if [ -f "$__object/parameter/format" ]; then
|
||||
format="$(cat "$__object/parameter/format")"
|
||||
else
|
||||
format='-u'
|
||||
fi
|
||||
|
||||
# Dump the timestamp in UTC to the marker
|
||||
echo "date $format > $destination"
|
55
conf/type/__cdistmarker/man.text
Normal file
55
conf/type/__cdistmarker/man.text
Normal file
|
@ -0,0 +1,55 @@
|
|||
cdist-type__cdistmarker(7)
|
||||
==========================
|
||||
Daniel Maher <phrawzty+cdist at gmail.com>
|
||||
|
||||
|
||||
NAME
|
||||
----
|
||||
cdist-type__cdistmarker - Add a timestamped cdist marker.
|
||||
|
||||
|
||||
DESCRIPTION
|
||||
-----------
|
||||
This type is used to add a common marker file which indicates that a given
|
||||
machine is being managed by cdist. The contents of this file consist of a
|
||||
timestamp, which can be used to determine the most recent time at which cdist
|
||||
was run against the machine in question.
|
||||
|
||||
|
||||
REQUIRED PARAMETERS
|
||||
-------------------
|
||||
None.
|
||||
|
||||
|
||||
OPTIONAL PARAMETERS
|
||||
-------------------
|
||||
destination::
|
||||
The path and filename of the marker.
|
||||
Default: /etc/cdist-configured
|
||||
|
||||
format::
|
||||
The format of the timestamp. This is passed directly to system 'date'.
|
||||
Default: -u
|
||||
|
||||
|
||||
EXAMPLES
|
||||
--------
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
# Creates the marker as normal.
|
||||
__cdistmarker
|
||||
|
||||
# Creates the marker differently.
|
||||
__cdistmarker --file /tmp/cdist_marker --format '+%s'
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
|
||||
SEE ALSO
|
||||
--------
|
||||
- cdist-type(7)
|
||||
|
||||
|
||||
COPYING
|
||||
-------
|
||||
Copyright \(C) 2011 Daniel Maher. Free use of this software is granted under
|
||||
the terms of the GNU General Public License version 3 (GPLv3).
|
2
conf/type/__cdistmarker/parameter/optional
Normal file
2
conf/type/__cdistmarker/parameter/optional
Normal file
|
@ -0,0 +1,2 @@
|
|||
destination
|
||||
format
|
0
conf/type/__cdistmarker/singleton
Normal file
0
conf/type/__cdistmarker/singleton
Normal file
Loading…
Reference in a new issue