Page MenuHomeDevCentral

D1039.diff
No OneTemporary

D1039.diff

diff --git a/CHANGELOG.md b/CHANGELOG.md
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,7 +4,12 @@
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
+## 0.0.2 - 2017-10-06
+### Added
+ - Man pages for salt-get-config-dir(1) salt-wrapper(1) and salt-wrapper.conf(5)
## 0.0.1 - 2017-10-05
### Added
- Initial release with `salt-get-config-dir` and `salt-wrapper` commands.
+
+[0.0.2]: https://github.com/nasqueron/salt-wrapper/compare/v0.0.1...v0.0.2
diff --git a/Makefile b/Makefile
--- a/Makefile
+++ b/Makefile
@@ -7,16 +7,38 @@
INSTALL=/usr/bin/install
RM=/bin/rm -f
+GZIP=/usr/bin/gzip
PREFIX?=/usr/local
+MANDIR?=/usr/local/man
# -------------------------------------------------------------
# Installation main targets
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-install:
+install: install-bin install-man
+
+deinstall: deinstall-bin deinstall-man
+
+# -------------------------------------------------------------
+# Installation detailled targets
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+
+install-bin:
${INSTALL} salt-get-config-dir.py ${PREFIX}/bin/salt-get-config-dir
${INSTALL} salt-wrapper.sh ${PREFIX}/bin/salt-wrapper
-deinstall:
+install-man:
+ ${INSTALL} -m 444 man/salt-wrapper.1 man/salt-get-config-dir.1 ${MANDIR}/man1
+ ${INSTALL} -m 444 man/salt-wrapper.conf.5 ${MANDIR}/man5
+ ${GZIP} ${MANDIR}/man1/salt-wrapper.1
+ ${GZIP} ${MANDIR}/man1/salt-get-config-dir.1
+ ${GZIP} ${MANDIR}/man5/salt-wrapper.conf.5
+
+deinstall-bin:
${RM} ${PREFIX}/bin/salt-get-config-dir
${RM} ${PREFIX}/bin/salt-wrapper
+
+deinstall-man:
+ ${RM} ${MANDIR}/man1/salt-wrapper.1.gz
+ ${RM} ${MANDIR}/man1/salt-get-config-dir.1.gz
+ ${RM} ${MANDIR}/man5/salt-wrapper.conf.5.gz
diff --git a/man/salt-get-config-dir.1 b/man/salt-get-config-dir.1
new file mode 100644
--- /dev/null
+++ b/man/salt-get-config-dir.1
@@ -0,0 +1,34 @@
+.Dd $Mdocdate$
+.Dt SALT-GET-CONFIG-DIR 1
+.Os Nasqueron
+.Sh NAME
+.Nm salt-get-config-dir
+.Nd determine the Salt configuration directory from the current working directory
+.Sh SYNOPSIS
+.Nm salt-get-config-dir
+.Sh DESCRIPTION
+The
+.Nm
+utility finds a match between the current working directory and the wrapper
+configuration file, then prints to stdout the matching configuration directory.
+.Sh ENVIRONMENT
+.Bl -tag -width SALT_WRAPPER_CONF
+.It Ev SALT_WRAPPER_CONF
+Path to the configuration file. If omitted, the default path
+.Pa /usr/local/etc/salt-wrapper.conf
+will be used.
+.Elb
+.Sh EXIT STATUS
+The
+.Nm
+utility exits 0 on success, 1 the directory can't be found
+and >1 if an error occurs.
+.Sh SEE ALSO
+.Xr salt-wrapper 1
+.Xr salt-wrapper.conf 5
+.Sh CAVEATS
+.Nm
+is not intended to be called explicitly from the command line,
+but used by the
+.Nm salt-wrapper
+command.
diff --git a/man/salt-wrapper.1 b/man/salt-wrapper.1
new file mode 100644
--- /dev/null
+++ b/man/salt-wrapper.1
@@ -0,0 +1,50 @@
+.Dd $Mdocdate$
+.Dt SALT-WRAPPER 1
+.Os Nasqueron
+.Sh NAME
+.Nm salt-wrapper
+.Nd invoke Salt with correct config dir and sudo capability
+.Sh SYNOPSIS
+.Nm salt-wrapper
+.Ar salt-command
+.Op ...
+.Sh DESCRIPTION
+The
+.Nm
+utility invokes the specified Salt command, prepended by a sudo
+call to execute the command as the Salt user (see below).
+
+.Nm
+also appends a
+.Ar --config-dir
+argument, with the Salt configuration directory matching the
+current working directory, as provided by the
+.Nm salt-get-config-dir
+program.
+.Sh SALT USER
+Every command is executed as the
+.Sy salt
+user.
+
+The
+.Nm
+.Ar salt-call
+.Ar --local
+command will execute as
+.Sy root
+instead, to allow to modify the current server.
+.Sh EXIT STATUS
+The
+.Nm
+utility exits 0 on success, and >0 if an error occurs.
+.Sh SEE ALSO
+.Xr salt-get-config-dir 1
+.Xr salt-wrapper.conf 5
+.Sh CAVEATS
+.Nm
+is not intended to be called explicitly from the command line,
+but aliased in the shell to wrap implicitly and automatically
+the Salt command.
+
+https://docs.nasqueron.org/salt-wrapper/admin.html#shell-aliases
+gives the syntax to use for C and bourne shells.
diff --git a/man/salt-wrapper.conf.5 b/man/salt-wrapper.conf.5
new file mode 100644
--- /dev/null
+++ b/man/salt-wrapper.conf.5
@@ -0,0 +1,56 @@
+.Dd $Mdocdate$
+.Dt MAIN-WRAPPER.CONF 5
+.Os Nasqueron
+.Sh NAME
+.Pa /usr/local/etc/salt-wrapper.conf
+.Nd configure salt-wrapper
+.Sh DESCRIPTION
+The
+.Pa /usr/local/etc/salt-wrapper.conf
+configuration file contains a map of directories for the
+.Nm salt-get-config-dir
+command.
+
+The map is the answer to the question “For a given current working directory, what's the Salt configuration directory to use?”.
+.Sh FILE FORMAT
+The configuration file is written in JSON.
+
+The
+.Va roots
+.Vt array
+contains an entry for each directory to map.
+
+Each entry is an
+.Vt object
+with two
+.Vt strings
+to map the directories:
+.Bl -tag -offset indent -width states
+.It Va config
+The directory containing the Salt configuration
+.It Va states
+The current working directory containing the Salt states
+.El
+.Sh EXAMPLE
+The following file can be used to use the default Salt config directory for
+.Pa /opt/nasqueron-operations
+but a custom secondary config directory for
+.Pa /opt/woodscloud-operations
+working directory:
+.Bd -literal -offset indent
+{
+ "roots": [
+ {
+ "config": "/usr/local/etc/salt-woodscloud",
+ "states": "/opt/woodscloud-operations"
+ },
+ {
+ "config": "/usr/local/etc/salt",
+ "states": "/opt/nasqueron-operations"
+ }
+ ]
+}
+.Ed
+.Sh SEE ALSO
+.Xr salt-wrapper 1
+.Xr salt-get-config-dir 1

File Metadata

Mime Type
text/plain
Expires
Mon, Nov 18, 18:41 (22 h, 20 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2250959
Default Alt Text
D1039.diff (5 KB)

Event Timeline