diff --git a/cdist/conf/type/__chroot_mount/man.rst b/cdist/conf/type/__chroot_mount/man.rst index 5ffd7de5..0d7cdce3 100644 --- a/cdist/conf/type/__chroot_mount/man.rst +++ b/cdist/conf/type/__chroot_mount/man.rst @@ -1,9 +1,9 @@ -cdist-type__install_chroot_mount(7) +cdist-type__chroot_mount(7) =================================== NAME ---- -cdist-type__install_chroot_mount - mount a chroot +cdist-type__chroot_mount - mount a chroot DESCRIPTION @@ -26,7 +26,7 @@ EXAMPLES .. code-block:: sh - __install_chroot_mount /path/to/chroot + __chroot_mount /path/to/chroot AUTHORS diff --git a/cdist/conf/type/__chroot_umount/man.rst b/cdist/conf/type/__chroot_umount/man.rst index a2ea1d9b..ff116da5 100644 --- a/cdist/conf/type/__chroot_umount/man.rst +++ b/cdist/conf/type/__chroot_umount/man.rst @@ -1,9 +1,9 @@ -cdist-type__install_chroot_umount(7) -==================================== +cdist-type__chroot_umount(7) +============================ NAME ---- -cdist-type__install_chroot_umount - unmount a chroot mounted by __chroot_mount +cdist-type__chroot_umount - unmount a chroot mounted by __chroot_mount DESCRIPTION @@ -26,7 +26,7 @@ EXAMPLES .. code-block:: sh - __install_chroot_umount /path/to/chroot + __chroot_umount /path/to/chroot SEE ALSO diff --git a/cdist/conf/type/__install_chroot_mount/man.rst b/cdist/conf/type/__install_chroot_mount/man.rst deleted file mode 120000 index 3267c3db..00000000 --- a/cdist/conf/type/__install_chroot_mount/man.rst +++ /dev/null @@ -1 +0,0 @@ -../__chroot_mount/man.rst \ No newline at end of file diff --git a/cdist/conf/type/__install_chroot_mount/man.rst b/cdist/conf/type/__install_chroot_mount/man.rst new file mode 100644 index 00000000..4054c4c4 --- /dev/null +++ b/cdist/conf/type/__install_chroot_mount/man.rst @@ -0,0 +1,42 @@ +cdist-type__install_chroot_mount(7) +=================================== + +NAME +---- +cdist-type__install_chroot_mount - mount a chroot with install command + + +DESCRIPTION +----------- +Mount and prepare a chroot for running commands within it. + + +REQUIRED PARAMETERS +------------------- +None + + +OPTIONAL PARAMETERS +------------------- +None + + +EXAMPLES +-------- + +.. code-block:: sh + + __install_chroot_mount /path/to/chroot + + +AUTHORS +------- +Steven Armstrong + + +COPYING +------- +Copyright \(C) 2012 Steven Armstrong. 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. diff --git a/cdist/conf/type/__install_chroot_umount/man.rst b/cdist/conf/type/__install_chroot_umount/man.rst deleted file mode 120000 index fa34c4b0..00000000 --- a/cdist/conf/type/__install_chroot_umount/man.rst +++ /dev/null @@ -1 +0,0 @@ -../__chroot_umount/man.rst \ No newline at end of file diff --git a/cdist/conf/type/__install_chroot_umount/man.rst b/cdist/conf/type/__install_chroot_umount/man.rst new file mode 100644 index 00000000..2e020c01 --- /dev/null +++ b/cdist/conf/type/__install_chroot_umount/man.rst @@ -0,0 +1,47 @@ +cdist-type__install_chroot_umount(7) +==================================== + +NAME +---- +cdist-type__install_chroot_umount - unmount a chroot mounted by __install_chroot_mount + + +DESCRIPTION +----------- +Undo what __install_chroot_mount did. + + +REQUIRED PARAMETERS +------------------- +None + + +OPTIONAL PARAMETERS +------------------- +None + + +EXAMPLES +-------- + +.. code-block:: sh + + __install_chroot_umount /path/to/chroot + + +SEE ALSO +-------- +:strong:`cdist-type__install_chroot_mount`\ (7) + + +AUTHORS +------- +Steven Armstrong + + +COPYING +------- +Copyright \(C) 2012 Steven Armstrong. 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. diff --git a/cdist/conf/type/__install_file/man.rst b/cdist/conf/type/__install_file/man.rst deleted file mode 120000 index c937b8af..00000000 --- a/cdist/conf/type/__install_file/man.rst +++ /dev/null @@ -1 +0,0 @@ -../__file/man.rst \ No newline at end of file diff --git a/cdist/conf/type/__install_file/man.rst b/cdist/conf/type/__install_file/man.rst new file mode 100644 index 00000000..c5409167 --- /dev/null +++ b/cdist/conf/type/__install_file/man.rst @@ -0,0 +1,112 @@ +cdist-type__install_file(7) +=========================== + +NAME +---- +cdist-type__install_file - Manage files with install command. + + +DESCRIPTION +----------- +This cdist type allows you to create files, remove files and set file +attributes on the target. + +If the file already exists on the target, then if it is a: + +regular file, and state is: + present + replace it with the source file if they are not equal + exists + do nothing +symlink + replace it with the source file +directory + replace it with the source file + +In any case, make sure that the file attributes are as specified. + + +REQUIRED PARAMETERS +------------------- +None. + +OPTIONAL PARAMETERS +------------------- +state + 'present', 'absent' or 'exists', defaults to 'present' where: + + present + the file is exactly the one from source + absent + the file does not exist + exists + the file from source but only if it doesn't already exist + +group + Group to chgrp to. + +mode + Unix permissions, suitable for chmod. + +owner + User to chown to. + +source + If supplied, copy this file from the host running cdist to the target. + If not supplied, an empty file or directory will be created. + If source is '-' (dash), take what was written to stdin as the file content. + +MESSAGES +-------- +chgrp + Changed group membership +chown + Changed owner +chmod + Changed mode +create + Empty file was created (no --source specified) +remove + File exists, but state is absent, file will be removed by generated code. +upload + File was uploaded + + +EXAMPLES +-------- + +.. code-block:: sh + + # Create /etc/cdist-configured as an empty file + __install_file /etc/cdist-configured + # The same thing + __install_file /etc/cdist-configured --state present + # Use __file from another type + __install_file /etc/issue --source "$__type/files/archlinux" --state present + # Delete existing file + __install_file /etc/cdist-configured --state absent + # Supply some more settings + __install_file /etc/shadow --source "$__type/files/shadow" \ + --owner root --group shadow --mode 0640 \ + --state present + # Provide a default file, but let the user change it + __install_file /home/frodo/.bashrc --source "/etc/skel/.bashrc" \ + --state exists \ + --owner frodo --mode 0600 + # Take file content from stdin + __install_file /tmp/whatever --owner root --group root --mode 644 --source - << DONE + Here goes the content for /tmp/whatever + DONE + + +AUTHORS +------- +Nico Schottelius + + +COPYING +------- +Copyright \(C) 2011-2013 Nico Schottelius. 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. diff --git a/docs/changelog b/docs/changelog index ec85c50d..a84ebf10 100644 --- a/docs/changelog +++ b/docs/changelog @@ -2,6 +2,7 @@ Changelog --------- next: + * Documentation: Update docs for types that used man.rst as symbolic links (Darko Poljak) * Type __cron: no '# marker' for raw_command due to cron security (Daniel Heule) * New type: __docker_compose (Dominique Roux) * Type __apt_mark: Check supported apt version and if package is installed (Ander Punnar) diff --git a/docs/src/cdist-type.rst b/docs/src/cdist-type.rst index 1ff82ce0..2c5f9f6a 100644 --- a/docs/src/cdist-type.rst +++ b/docs/src/cdist-type.rst @@ -51,6 +51,19 @@ Example: __myfancysingleton --colour green +Config types +------------ +By default types are used with config command. These are types that are not +flagged by any known command flag. If a type is marked then it will be skipped +with config command. + + +Install types +------------- +If a type is flagged with 'install' flag then it is used only with install command. +With other commands, i.e. config, these types are skipped if used. + + How to write a new type ----------------------- A type consists of @@ -209,6 +222,18 @@ As you can see, the object ID is omitted, because it does not make any sense, if your type can be used only once. +Install - type with install command +----------------------------------- +If you want a type to be used with install command, you must mark it as +install: create the (empty) file "install" in your type directory: + +.. code-block:: sh + + touch cdist/conf/type/__install_NAME/install + +With other commands, i.e. config, it will be skipped if used. + + The type explorers ------------------ If a type needs to explore specific details, it can provide type specific