Merge branch 'master' into preos

This commit is contained in:
Nico Schottelius 2014-01-20 14:28:37 +01:00
commit 7988b3f8b9
11 changed files with 199 additions and 4 deletions

View file

@ -175,10 +175,12 @@ freecode-release: $(FREECODE_FILE)
################################################################################
# pypi
#
pypi-release: man $(PYTHON_VERSION)
PYPI_FILE=.pypi-release
$(PYPI_FILE): man $(PYTHON_VERSION)
python3 setup.py sdist upload
touch $@
pypi-release: $(PYPI_FILE)
################################################################################
# archlinux
#

View file

@ -1,6 +1,6 @@
#!/bin/sh
#
# 2010-2011 Nico Schottelius (nico-cdist at schottelius.org)
# 2010-2014 Nico Schottelius (nico-cdist at schottelius.org)
# 2012 Steven Armstrong (steven-cdist at armstrong.cc)
#
# This file is part of cdist.
@ -20,6 +20,6 @@
#
#
if command -v hostname >/dev/null; then
hostname -f
if command -v uname >/dev/null; then
uname -n
fi

View file

@ -0,0 +1,24 @@
#!/bin/sh
#
# 2014 Nico Schottelius (nico-cdist at schottelius.org)
#
# This file is part of 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/>.
#
#
# Check whether system has hostnamectl
#
command -v hostnamectl || true

View file

@ -0,0 +1,26 @@
#!/bin/sh
#
# 2014 Nico Schottelius (nico-cdist at schottelius.org)
#
# This file is part of 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/>.
#
#
# Retrieve the contents of /etc/hostname
#
if [ -f /etc/hostname ]; then
cat /etc/hostname
fi

View file

@ -0,0 +1,50 @@
#!/bin/sh
#
# 2014 Steven Armstrong (steven-cdist at armstrong.cc)
# 2014 Nico Schottelius (nico-cdist at schottelius.org)
#
# This file is part of 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/>.
#
if [ -f "$__object/parameter/name" ]; then
name_should="$(cat "$__object/parameter/name")"
else
name_should="$(echo "${__target_host%%.*}")"
fi
os=$(cat "$__global/explorer/os")
name_running=$(cat "$__global/explorer/hostname")
name_config=$(cat "$__object/explorer/hostname_file")
has_hostnamectl=$(cat "$__object/explorer/has_hostnamectl")
################################################################################
# If everything is ok -> exit
#
if [ "$name_config" = "$name_should" -a "$name_running" = "$name_should" ]; then
exit 0
fi
################################################################################
# Setup hostname
#
echo changed >> "$__messages_out"
if [ "$has_hostnamectl" ]; then
echo "hostnamectl set-hostname '$name_should'"
else
echo "hostname '$name_should'"
echo "printf '%s\n' '$name_should' > /etc/hostname"
fi

View file

@ -0,0 +1,52 @@
cdist-type__hostname(7)
=======================
Steven Armstrong <steven-cdist--@--armstrong.cc>
NAME
----
cdist-type__hostname - set the hostname
DESCRIPTION
-----------
Set's the hostname on various operating systems.
REQUIRED PARAMETERS
-------------------
None.
OPTIONAL PARAMETERS
-------------------
name::
The hostname to set. Defaults to the first segment of __target_host
(${__target_host%%.*})
MESSAGES
--------
changed::
Changed the hostname
EXAMPLES
--------
--------------------------------------------------------------------------------
# take hostname from __target_host
__hostname
# set hostname explicitly
__hostname --name some-static-hostname
--------------------------------------------------------------------------------
SEE ALSO
--------
- cdist-type(7)
COPYING
-------
Copyright \(C) 2012 Steven Armstrong. Free use of this software is
granted under the terms of the GNU General Public License version 3 (GPLv3).

View file

@ -0,0 +1,38 @@
#!/bin/sh
#
# 2012 Steven Armstrong (steven-cdist at armstrong.cc)
# 2014 Nico Schottelius (nico-cdist at schottelius.org)
#
# This file is part of 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/>.
#
os=$(cat "$__global/explorer/os")
not_supported() {
echo "Your operating system ($os) is currently not supported by this type (${__type##*/})." >&2
echo "Please contribute an implementation for it if you can." >&2
exit 1
}
case "$os" in
archlinux|debian|ubuntu)
# handled in gencode-remote
:
;;
*)
not_supported
;;
esac

View file

@ -0,0 +1 @@
name

View file

View file

@ -6,6 +6,8 @@ Changelog
3.0.3:
* Core: Enhance error message when requirement is missing object id
* Explorer hostname: Return host name by using uname -n
* New Type: __hostname (Steven Armstrong)
3.0.2: 2014-01-19
* Documentation: Document all messages sent by types (Daniel Heule)

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB