Merge remote-tracking branch 'ungleich/master' into keyboard-locale_system-types

This commit is contained in:
Darko Poljak 2016-08-10 18:29:57 +02:00
commit 8918186d53
27 changed files with 402 additions and 351 deletions

View file

@ -1,5 +1,10 @@
Changelog
---------
next:
* New type __filesystem: manage filesystems on devices ( Daniel Heule )
* New type: __locale_system (Steven Armstrong, Carlos Ortigoza, Nico Schottelius)
* New type: __sysctl (Steven Armstrong)
next:
* New type: __keyboard: Set keyboard layout (Carlos Ortigoza)
@ -155,7 +160,7 @@ next:
* Documentation: Cleanup up, added HTML links (Tomas Pospisek)
* Explorer interfaces: Remove test output (Daniel Heule)
* Type __jail: Add messaging support (Jake Guffey)
3.1.3: 2014-04-29
* New Type: __yum_repo (Steven Armstrong)
* Type __hostname: Add support for CentOS (Nico Schottelius)
@ -317,7 +322,7 @@ next:
* New Type: __postfix_postconf (Steven Armstrong)
* New Type: __postfix_postmap (Steven Armstrong)
* New Type: __postfix_reload (Steven Armstrong)
* Type __line: Ensure regex does not contain /
* Type __line: Ensure regex does not contain /
* Type __ssh_authorized_keys: Bugfix: Preserve ownership (Steven Armstrong)
2.3.3: 2013-09-09
@ -395,7 +400,7 @@ next:
* Support for CDIST_PATH (Steven Armstrong)
2.1.0pre8: 2012-11-15
* Type cleanup: __apt_ppa, __apt_ppa_update_index, __file,
* Type cleanup: __apt_ppa, __apt_ppa_update_index, __file,
__ssh_authorized_key, __timezone, all install types (Steven Armstrong)
* Types: Remove all parameter changing code (Nico Schottelius)
* Type __rvm_ruby: Change parameter "default" to be boolean (Nico Schottelius)
@ -459,7 +464,7 @@ next:
* Feature __group: Added support for FreeBSD (Jake Guffey)
* New Type: __package_zypper (Nico Schottelius)
* Feature Types: Initial Support for SuSE Linux (Nico Schottelius)
2.0.13: 2012-06-05
* Bugfix __ssh_authorized_key: Ensure it sets proper group (contradict)
* Bugfix __addifnosuchline: Fixed quotes/interpolation bug ("a b" became "a b") (Nico Schottelius)
@ -491,7 +496,7 @@ next:
* Various smaller bugfixes (Chris Lamb)
2.0.9: 2012-03-12
* Cleanup documentation: Fix environment variable list to be properly
* Cleanup documentation: Fix environment variable list to be properly
displayed (Giel van Schijndel)
* Cleanup documentation: Some minor corrections
* New Type: __package_opkg (Giel van Schijndel)
@ -500,7 +505,7 @@ next:
* Feature __package: Support for OpenWRT (Giel van Schijndel)
* Feature __start_on_boot: Support for OpenWRT (Giel van Schijndel)
* Feature __start_on_boot: Support for Amazon Linux (Matt Coddington)
* New Example: Use rsync to backup files (Matt Coddington)
* New Example: Use rsync to backup files (Matt Coddington)
* Feature core: Exit non-zero, if configuration failed (Nico Schottelius)
* Documentation: Describe how to do templating (Aurélien Bondis)
@ -545,7 +550,7 @@ next:
(Steven Armstrong, Daniel Maher)
* Cleanup: Explicitly require Python >= 3.2 (do not fail implicitly) (Nico Schottelius)
* Documentation: (Re)write of the tutorial (Nico Schottelius)
* Feature: __addifnosuchline supports matching on
* Feature: __addifnosuchline supports matching on
regular expressions (Daniel Maher)
* Feature: __directory, __file, __link:
Add --state parameter (Steven Armstrong)

View file

@ -1,17 +0,0 @@
== types with namespaces ==
- allow types to have namespaces, e.g.
__path/my/type
implemented as a proof of concept at:
https://github.com/asteven/cdist/tree/type-namespaces
Execute all global explorers only when needed #286
My intention is to create a brunch of global explorer which are of use in some cases and makes cdist more userfriendly. But now, all global explorers are allways executed, even the return value of the explorers is never used.
I think a possible approach can be to replace the result files with pipes, and on first read of the pipe, the explorer is executed by the core, all following read calls from the pipe are answered from the core with the result of the first real execute of the explorer.
So cdist can have an unlimited number of global explorers and only used explorers are executed on the target host, all other explorers laying around are simply ignored.
Also a possible approach would be to create a new explorer type (dynamic explorers) which are sitting in a different directory to (for example dynexploer) and only this ones are executed with the conditional approach explained above. So the overhead to create pipes and monitor it is only in place on explorers which are not interesting for everyone ...

View file

@ -1,108 +0,0 @@
#!/usr/bin/env bash
# Distributed under the terms of the GNU General Public License v2
# Copyright (c) 2006 Fernando J. Pereda <ferdy@gentoo.org>
#
# Git CIA bot in bash. (no, not the POSIX shell, bash).
# It is *heavily* based on Git ciabot.pl by Petr Baudis.
#
# It is meant to be run either on a post-commit hook or in an update
# hook:
#
# post-commit: It parses latest commit and current HEAD to get the
# information it needs.
#
# update: You have to call it once per merged commit:
#
# refname=$1
# oldhead=$2
# newhead=$3
# for merged in $(git rev-list ${oldhead}..${newhead} | tac) ; do
# /path/to/ciabot.bash ${refname} ${merged}
# done
#
# The project as known to CIA
project="cdist"
# Set to true if you want the full log to be sent
noisy=false
# Addresses for the e-mail
from="nico-cia.vc@schottelius.org"
to="cia@cia.vc"
# SMTP client to use
sendmail="/usr/sbin/sendmail -f ${from} ${to}"
# Changeset URL
url="http://git.schottelius.org/?p=${project};a=commit;h=@@sha1@@"
# You shouldn't be touching anything else.
if [[ $# = 0 ]] ; then
refname=$(git symbolic-ref HEAD 2>/dev/null)
merged=$(git rev-parse HEAD)
else
refname=$1
merged=$2
fi
refname=${refname##refs/heads/}
gitver=$(git --version)
gitver=${gitver##* }
rev=$(git describe ${merged} 2>/dev/null)
[[ -z ${rev} ]] && rev=${merged:0:12}
rawcommit=$(git cat-file commit ${merged})
author=$(sed -n -e '/^author .*<\([^@]*\).*$/s--\1-p' \
<<< "${rawcommit}")
logmessage=$(sed -e '1,/^$/d' <<< "${rawcommit}")
${noisy} || logmessage=$(head -n 1 <<< "${logmessage}")
logmessage=${logmessage//&/&amp;}
logmessage=${logmessage//</&lt;}
logmessage=${logmessage//>/&gt;}
ts=$(sed -n -e '/^author .*> \([0-9]\+\).*$/s--\1-p' \
<<< "${rawcommit}")
out="
<message>
<generator>
<name>CIA Bash client for Git</name>
<version>${gitver}</version>
<url>http://dev.gentoo.org/~ferdy/stuff/ciabot.bash</url>
</generator>
<source>
<project>${project}</project>
<branch>${refname}</branch>
</source>
<timestamp>${ts}</timestamp>
<body>
<commit>
<author>${author}</author>
<revision>${rev}</revision>
<files>
$(git diff-tree -r --name-only ${merged} |
sed -e '1d' -e 's-.*-<file>&</file>-')
</files>
<log>
${logmessage}
</log>
<url>${url//@@sha1@@/${merged}}</url>
</commit>
</body>
</message>"
${sendmail} << EOM
Message-ID: <${merged:0:12}.${author}@${project}>
From: ${from}
To: ${to}
Content-type: text/xml
Subject: DeliverXML
${out}
EOM
# vim: set tw=70 :

View file

@ -1,25 +0,0 @@
#!/bin/sh
#
# 2010-2011 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/>.
#
#
# Generate documentation of exported variables
#
cat bin/* | awk '/^export/ { print $2 }'

View file

@ -1,28 +0,0 @@
#!/bin/sh
#
# 2011 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/>.
#
#
# Sync repo to testhosts
#
dirs="cdist cdist-nutzung"
for dir in $dirs; do
rsync -av --delete /home/users/nico/p/$dir/ root@rnic01:$dir
done

View file

@ -1 +0,0 @@
- remove __self and all references to it

View file

@ -1,25 +0,0 @@
- introduce default parameters
- valid for optional parameters only
- stored in parameter/default/$name
- when/where to save? in emulator?
- read vi fsproperty?
- cleanup object_id handling
- have a look at singletons
- update/create docs
- cdist-cache::
How to get use information about the hosts we have been working on [advanced]
- cdist-scaling-tuning::
How to scale out with cdist and which tunings to apply. [advanced]
- cdist-installation
How to use cdist to install hosts
- check speech publishing
- and speeches, which may be outdated as well
- Create new video for cdist 2.x
http://www.youtube.com/watch?v=PRMjzy48eTI
- exec flag is not true for manifest anymore
- SSH HINTS - ssh agent

View file

@ -1,6 +1,3 @@
- Migrate scripts from bin/* to functions in bin/cdist-deploy-to
- Use one pipe-shell for type execution
- Parallelise gencode and code-run of all objects
- Diff against local cache only instead of real target
- Use only one ssh session?
- Can be indirectly improved via ssh config already!

View file

@ -1,118 +0,0 @@
autorequire:
- objects defined in type manifests should be automatically prerequisites of the current object
- __foo/some-id
__other other-id --state present
=> require="__other/other-id" __foo/some-id
metaparameters:
- steal the metaparameters from puppet:
# I have to be there before the other one
__directory /etc/ssh \
--before __file/etc/ssh/sshd_config
# the other one has to be there before me
__file /etc/ssh/sshd_config \
--after __directory/etc/ssh
# if I change, tell the other one about it
__file /etc/ssh/sshd_config \
--notify __init_script/etc/rc.d/sshd
# whenever the other one changes, I want to know
__init_script /etc/rc.d/sshd \
--subscribe __file/etc/ssh/sshd_config
- how does a type react to a received 'event'?
- maybe something like:
__some_type/
manifest
...
gencode-refresh
...
- gencode-refresh -> code-refresh -> ssh $target sh -e code-refresh
logging:
- logging from type emulator without clobbering stdout
maybe implement logging server as described here [1]
[1] http://docs.python.org/py3k/howto/logging-cookbook.html#configuration-server-example
- use different logger to limit output to current area of interest,
e.g.
explorer.$target_host: explorer related messages for the run for $target_host
manifest.$target_host: manifest related messages for the run for $target_host
...
then one could filter e.g. on explorer.*
- more granular debug output,
[2] http://blog.ooz.ie/2011/03/python-logging-extending-standard.html
tests:
__init__():
- sets up env: __target_host
run_initial_manifest():
- parameter is actually used (from __init__)
- ensure changing the manifest actually runs a different manifest
-> give ConfigInstall Constructor different manifest
-> different manifest is executed.
- test all submitted (from core to type manifest) variables:
- ENVIRONMENT
- they are set
- they contain the correct values
run_type_manifest():
- test all submitted (from core to type manifest) variables:
- ENVIRONMENT
- they are set
- they contain the correct values
- same tests as for test_initial_manifest_*?
run_manifest():
- test all submitted variables:
- ENVIRONMENT
- including __debug, if debug
- they are set
- they contain the correct values
- does $require work?
- check that exception raised, if manifest is not existent
object_run():
- ensure no object is run twice
- ensure requirements are taken into account?
- and order of run is adjusted
- check (from extern?) that all needed variables are setup
- ensure no code-{local, remote} is created,
if gencode is not producing code
- ensure THAT code-{local, remote} contains what gencode created
- abort if gencode-* fails
- abort if code-* fails
- abort == raise(FooException)
- gencode-*: ensure ENVIRONMENT is setup correctly
run_type_explorer()
- ensure ALL type explores have been run
- ensure output is saved to correct path
- ensure a type with {0,1,2} explorers works ?
- none, one, multiple
- ensure ENVIRONMENT is setup correctly
- fails if ANY of the given explorer fails
run_global_explorers():
- ensure ALL type explores have been run
- ensure output is saved to correct path
- ensure a type with {0,1,2} explorers works ?
- none, one, multiple
- ensure ENVIRONMENT is setup correctly
- fails if ANY of the given explorer fails
Code fixes needed:
- shutil, os.mkdir, etc. everywhere: catch/reraise exceptions correctly

View file

@ -1,27 +0,0 @@
Tests needed for config_install:
cleanup()
- Fail if cache_dir from previous run cannot be deleted
- Fail if cache_dir cannot be created from current out_dir
filter()
- ensure logformat is changed: target host is prefixed:
LOGLEVEL: target_host: MESSAGE
link_emulator():
- ensure that links to ALL types are created
- ensure that links points to correct executable
- i.e. readlink() works
- AND target of readlink is the correct executable
remote_mkdir()
- is directory created
remove_remote_path
- is path removed
transfer_path
- is src to dst transferred?
emulator:
may only be called with __ as prefix - fail otherwise!