Commit graph

3354 commits

Author SHA1 Message Date
Daniel Hokka Zakrisson
43bdec8b20 Throw an error if multiple actions have been specified 2012-11-26 22:42:44 +01:00
Daniel Hokka Zakrisson
1e0295c7e2 Template handlers late
This allows overriding variables in name, and removes templating from
parsing.
2012-11-26 22:07:57 +01:00
Daniel Hokka Zakrisson
ebd31af940 Don't prompt for vars in extra-vars
Fixes #1622.
2012-11-26 22:07:57 +01:00
Daniel Hokka Zakrisson
94fc3006e9 Make variables local to the play
Fixes #1677.
2012-11-26 22:07:57 +01:00
Michael DeHaan
fa63e9ce1f Merge pull request #1680 from eest/fix_fbsd_enable
Rework FreeBSD "enabled" code
2012-11-26 12:18:17 -08:00
Patrik Lundin
d4af9e4c5c Use shlex for rc.conf parsing.
This makes the line parsing a lot more robust (and easier to read).
Code supplied by @dhozac, thanks!

Remove re import because this is not used anywhere.
2012-11-25 13:09:54 +01:00
Patrik Lundin
fde00327b0 Rework "enabled" implementation for FreeBSD.
When trying to perform enabled=yes followed by enabled=no
against FreeBSD the module would die with the following error:
TypeError: sub() takes at most 4 arguments (5 given)

The target FreeBSD client (8.2) is running python 2.6.6. It seems the
extra 'flags' argument was added to re.sub() in 2.7.

In fixing this issue I have attempted to create a general atomic method
for modifying a rc.conf file. Hopefully this will make it easier to add
other rc based platorms. The strip/split magic was inspired by the user
module.
2012-11-25 13:09:54 +01:00
Daniel Hokka Zakrisson
0c70abfaa9 Make sure any existing groups gets reused 2012-11-25 12:42:30 +01:00
Daniel Hokka Zakrisson
5504f13c68 Create groups in the first run through the file
Fixes #1208.
2012-11-25 01:00:14 +01:00
Daniel Hokka Zakrisson
4679d8d6e5 Remove references to non-existant variable rc 2012-11-25 00:23:29 +01:00
Daniel Hokka Zakrisson
1ec2a59073 Merge pull request #1676 from dagwieers/service-action-fix
The vars stop/start were intended as strings
2012-11-24 15:16:30 -08:00
Daniel Hokka Zakrisson
2bfb7deec0 Set all in the returned dict
Otherwise the group is lost, and group_vars/all isn't used.
2012-11-25 00:15:22 +01:00
Dag Wieers
18b797f096 The vars stop/start were intended as strings
This is a typo that was reported on IRC, because of this people got: "NameError: global name 'stop' is not defined".
2012-11-25 00:13:53 +01:00
Michael DeHaan
002fa07913 Merge pull request #1673 from JensRantil/fix-minor-docsite-spelling-mistake
Fix minor spelling mistake in docsite
2012-11-24 14:03:34 -08:00
Jens Rantil
6e3e1c74c9 Fix minor spelling mistake in docsite 2012-11-24 22:55:56 +01:00
Michael DeHaan
d5fb81fe0b Merge pull request #1671 from tonk/devel
Added pip-python to the search for CentOS 6 compatibility
2012-11-24 08:30:56 -08:00
Michael DeHaan
33196ec131 Merge pull request #1669 from dagwieers/ssh-tcgetattr2
Use proper pseudo-tty's instead of pipes when using subprocess
2012-11-24 08:30:26 -08:00
Ton Kersten
7bba04b176 Corrected for fallthrough 2012-11-24 16:26:15 +01:00
Ton Kersten
ee4fe9ff55 Added pip-python to the search for CentOS 6 compatibility 2012-11-24 13:36:32 +01:00
Dag Wieers
7192eb3047 Use proper pseudo-tty's instead of pipes when using subprocess
This change avoids the "tcgetattr: Invalid argument" error by making sure the ssh we start does have a proper pseudo-tty.

We could also check whether our current terminal is a proper terminal (by doing a tcgetattr ourselves) but I don't think this adds anything.

This closes #1662 (if all use-cases have been tested: sudo, passwd)
2012-11-23 22:39:30 +01:00
Michael DeHaan
ac09b47ec4 Merge pull request #1668 from eest/refactor_service_module
Repost: Refactor service module to use subclasses like user module.
2012-11-23 13:19:09 -08:00
Patrik Lundin
5b7aa494b2 Refactor module to use subclasses like user module.
* Basically the moving parts from the original service module arranged in
  subclasses.
* General structure and helper methods comes from the user module.
* Less forgiving to unsupported platforms: it requires a subclass per platform.
  (This makes it easier to work on one platform without having to think about.
  what other platform might be affected in unexpected ways).
* Now has basic OpenBSD support.
* Solaris support needs to be added.

Thanks to @dhozac for general advice and Linux testing.
Thanks to @bcoca for clearing up some FreeBSD questions.
2012-11-23 21:03:17 +01:00
Michael DeHaan
ce487a8544 Merge pull request #1658 from jpmens/docs_2
module_formatter: re-instate code
2012-11-23 07:58:48 -08:00
Michael DeHaan
3981c72957 Streamline code 2012-11-23 10:58:17 -05:00
Michael DeHaan
17020d6a75 Merge pull request #1656 from dagwieers/setup-virtualization
Implemented more virtualization types
2012-11-23 07:55:42 -08:00
Michael DeHaan
9d7739112a Merge pull request #1661 from jpmens/yumdoc
DOCUMENTATION: yum (moved version to added)
2012-11-23 07:53:06 -08:00
Daniel Hokka Zakrisson
db1a65342a Set -c local cwd to . if basedir is empty 2012-11-23 13:36:09 +01:00
Daniel Hokka Zakrisson
715d875dcb Group should only return its own variables
Otherwise, a host in two groups, A and B, using a variable defined
in group A and all will get the value of all, as B's variables will
include the all variable.

Partially fixes #1647.
2012-11-23 00:54:07 +01:00
Daniel Hokka Zakrisson
e44b85daba Remove special-casing for all group
global_vars has higher precedence than inventory. Putting the all
group's variables into it overrides all other groups and hosts.

Partially fixes #1647.
2012-11-23 00:54:02 +01:00
Daniel Hokka Zakrisson
bd7e02d629 Get all groups' variables in order of depth
Fixes all not being processed, as well as the order of the variable
precedence
2012-11-23 00:20:52 +01:00
Daniel Hokka Zakrisson
d5dd89a8f7 Allow specifying when: ... 2012-11-22 23:11:42 +01:00
Daniel Hokka Zakrisson
fd732f8d3b Add when_boolean
Fixes #1567.
2012-11-22 23:10:11 +01:00
Daniel Hokka Zakrisson
ddef608c94 Wrap all remote commands in sh 2012-11-22 20:06:30 +01:00
Jan-Piet Mens
3b83295581 DOCUMENTATION: yum (moved version to added) 2012-11-22 15:16:20 +01:00
Jan-Piet Mens
068ef0e979 module_formatter: re-instate code 2012-11-22 07:23:10 +01:00
Dag Wieers
e528826dba Implemented more virtualization types
I added all known virtualization types from the virt-what project. However, the few virt types that rely on cpuid information have not been implemented lacking native python cpuid access. (hyperv)
2012-11-22 02:48:13 +01:00
Michael DeHaan
8e515c0c94 Merge pull request #1655 from jpmens/docs_jumbopatch
DOCUMENTATION strings
2012-11-21 16:08:17 -08:00
Daniel Hokka Zakrisson
047d089cea Restore git output on --version
Broken by the move from utils.py to utils/__init__.py
2012-11-21 23:54:42 +01:00
Daniel Hokka Zakrisson
ef357ed1f2 Use the play's vars for the setup step
Allows using -e ansible_ssh_port=foo and have it apply to all actions.
2012-11-21 23:42:24 +01:00
Jan-Piet Mens
caf003c813 DOCUMENTATION strings 2012-11-21 18:49:30 +01:00
Daniel Hokka Zakrisson
d1c285b70b Port may be an integer when parsed from the play 2012-11-21 17:20:03 +01:00
Michael DeHaan
30fd37a68f Merge pull request #1654 from dagwieers/service-None-fix
Make the default an empty string
2012-11-21 07:15:20 -08:00
Dag Wieers
118ccc68c9 Make the default an empty string
Seems a bit strange I have to set a default in two locations.
2012-11-21 16:11:20 +01:00
Michael DeHaan
82f4aef959 Merge pull request #1648 from dhozac/local-cwd-basedir
Use runner's basedir as cwd for -c local
2012-11-21 06:40:01 -08:00
Michael DeHaan
41af2fce64 Merge pull request #1650 from dagwieers/port-not-integer-exception
Provide a proper error when the remote_port is not an integer
2012-11-21 06:39:24 -08:00
Daniel Hokka Zakrisson
3ce63d845e remote_port is None by default 2012-11-21 14:10:10 +01:00
Daniel Hokka Zakrisson
6b69b37eb0 Merge pull request #1649 from dagwieers/template-port
Allow the remote port to be templated per play
2012-11-20 13:16:34 -08:00
Dag Wieers
85bba04a1c Provide a proper error when the provided port is not an integer
As reported on the mailinglist, the user received a ValueError when the port number was not templated (fixed in #1649) and therefore it was not an integer. This change will catch the exception and provide a proper error so it is more clear.
2012-11-20 19:06:27 +01:00
Dag Wieers
8458f53014 Allow the remote port to be templated
This was requested on the mailinglist and seems useful.
2012-11-20 18:53:40 +01:00
Daniel Hokka Zakrisson
48898993b9 Fix removing of temporary files 2012-11-20 16:51:19 +01:00