Commit Graph

44 Commits (031c4e283a399a863fb9f7f621efeb31b92ae363)

Author SHA1 Message Date
Seth Vidal 34f8fb8e2b command: make sure that all _handle_aliases() calls returns {}
module_common: also work if there are no aliases (shell, command, etc) modules
12 years ago
Stephen Fromm 3f88a14b86 Various cleanup to run_command
* Rename fail_on_rc_non_zero to check_rc, much more succinct.
* Simplify method defintion
* Fix command module and drop shell=shell option; whether to use
  shell is determined by if args is a list.
12 years ago
Stephen Fromm e4964f42e0 Update modules to use run_command in module_common.py
This updates apt, apt_repository, command, cron, easy_install, facter,
fireball, git, group, mount, ohai, pip, service, setup, subversion,
supervisorctl, svr4pkg, user, and yum to take advantage of run_command
in module_common.py.
12 years ago
Jan-Piet Mens d184f72aa9 DOCUMENTATION strings 12 years ago
Michael DeHaan 6f6559670f chmod -x for all module files in source checkout 12 years ago
Felix Ingram 3a409a457c Add an "executable" option to the command and shell modules
The option will be passed to the Popen object created and will be used to
execute the command instead of the default shell.
12 years ago
Dag Wieers f26148d4b9 Use return codes > 255 for Ansible-specific errors.
I had made and pushed this change after you already pulled the request.

@dhozac indicated that it would probably be better to use return codes > 255 for anything related to Ansible itself. Which makes sens :)
12 years ago
Dag Wieers 2c4d559523 Make sure we always return 'rc' from the command module
If this is not a certainty, playbooks will fail without an 'rc' and checking both if there is an rc, and whether the 'rc' is (not) 0 is very complicated. (especially because ${something.rc} will not be substituted and all that)
12 years ago
Daniel Hokka Zakrisson 57df6da305 Only strip trailing newlines from output, preserving other space 12 years ago
Jan-Piet Mens d069c57974 Reformat code: examples consistently
- added terse syntax to modules.rst
 - added description of special variables to template module
12 years ago
Michael DeHaan 2d096ea425 Fixing various module related things. 12 years ago
Michael DeHaan f3e8ffce43 Call os.path.expanduser in the creates= and removes= section of the command module so ~/ and the like works. 12 years ago
Michael DeHaan 2f14545f2c Merge pull request #1170 from jpmens/docspatch01
Jumbo DOCUMENTATION patch
12 years ago
Daniel Hokka Zakrisson 98be6a328b Use a regexp to filter out arguments instead
pipes.quote is a bit overzealous for what we want to do, quoting ;
and other characters that you most likely want to use in your shell
invocations. The regexp is the best I could come up with to be able
to only replace the parts of the arguments that shouldn't be
executed.
12 years ago
Jan-Piet Mens c78a0a4a49 Jumbo DOCUMENTATION patch 12 years ago
Daniel Hokka Zakrisson 10d31fa872 Properly parse escaped special arguments
Fixes issue #1134
12 years ago
Jan-Piet Mens 267ada33eb Module DOCUMENTATION: assemble, authorized_key, command, copy
plus a small fix in rst.j2 template
  manpages generated & checked
  modules.html generated & checked
12 years ago
Marco Vito Moscaritolo c5ee1e7ec9 Add support to removes control param
Execute action only if specified file using param removes exist (execute reverse control of creates).

Some usage eg.:

```yaml
- name: enable apache2 default websites
  action: command /usr/sbin/a2ensite $item
creates=/etc/apache2/sites-enabled/$item
  with_items:
    - default
    - default-ssl

- name: disable apache2 default websites
  action: command /usr/sbin/a2dissite $item
removes=/etc/apache2/sites-enabled/$item
  with_items:
    - default
    - default-ssl
```
12 years ago
willthames 65a0f60c30 Allow ~ expansion in chdir argument of command module
This allows the use of ~ in the chdir argument of the command module
I know the later change is absolutely necessary as the first change
was not sufficient. It may be that the first change fixes shell and
the second fixes command.
12 years ago
Michael DeHaan 51e85b4bde Make a more logical error when the command/shell module is used with no arguments. 12 years ago
Michael DeHaan 498bebd03e update config code 12 years ago
Michael DeHaan ed449ed3e2 Fix indentation 12 years ago
Michael DeHaan 3c2eba57fd Make pep8 tests run against the library directory as well, and associated tweaks (mostly to indentation) in the library
directory.
12 years ago
Michael DeHaan 34ca8d7179 Allow unicode transfer by not base64 encoding. Also: faster 13 years ago
Michael DeHaan fe9b0bf38d Teach the common module code to warn users about typo'd arguments and also set everything to None automatically such
that code doesn't have to do a lot of params.get('foo', None) everywhere.
13 years ago
Petros Moisiadis 218a63f58f added a 'chdir' argument to the command module
the 'chdir' argument changes the current working directory to the
fullpath supplied as its value, before the execution of the command.
13 years ago
Michael DeHaan aa20ae5c02 Port command module over to new common code. Notice that this has to subclass AnsibleModule -- this should be the only
one that has to do that.
13 years ago
Stephen Fromm 67ee30f135 Apply logging of arguments to modules (issue #122)
The ohai and facter modules use /usr/bin/logger to log the fact that
they have been invoked.  I added 'import os' to the ping module
so that it could have the same syslog statements as the other modules.
I separated the condensed:
    shlex.split(open(argfile, 'r').read())
into two separate statements similar to the other modules.
13 years ago
Michael DeHaan 16f3d018c0 Added 'creates=filename' to the shell/command module, which can skip command execution if a file
already exists
13 years ago
Michael DeHaan be723aa98b 'shell' is a magic module that executes the command module with shell=True 13 years ago
Michael DeHaan 842d7cca6f Fix async to use the new argfiles method (wrapping brain around rock, really must write module development guide) 13 years ago
Seth Vidal 903178cdd4 convert so they handle argsfiles rather than arguments 13 years ago
Michael DeHaan 749b00a571 Strip trailing newlines from command module, which happens in some shell commands 13 years ago
Michael DeHaan 35d498aeba make command module error when no -a more obvious as command is the default module and someone
may forget about -a.  The CLI already warns about no host pattern by pulling up usage.
13 years ago
Michael DeHaan 7638c0ecf8 -p has been replaced by a required option. Various docs changes. 13 years ago
Michael DeHaan 0491fa1dda have command module raise an error if no arguments are supplied 13 years ago
Michael DeHaan a5499d8992 Add ansible command, fix import error in runner 13 years ago
Michael DeHaan 1bd1552b43 Relicensing to GPLv3, all previous committers ok'd on mailing list. 13 years ago
Seth Vidal a26f236e9b when it is an IOError or an OSError - return a normal error message instead of a traceback barf 13 years ago
Michael DeHaan fed3462502 applying indentation patch from skvidal 13 years ago
Michael DeHaan 3e010b9500 Added remote templating engine using jinja2, see examples/playbook.yml for usage.
Cleanup is due in runner.py
13 years ago
Jeremy Katz 8336f0d650 Don't use a shell and thus avoid a whole class of problems 13 years ago
Jeremy Katz 2a3a0d60cd Fall back to standalone simplejson module
CentOS5 has python 2.4 which doesn't have a built-in json
module
13 years ago
Michael DeHaan e0661a17eb Added command module 13 years ago