diff options
author | Bill Nottingham <notting@splat.cc> | 2015-07-27 11:02:24 -0400 |
---|---|---|
committer | Bill Nottingham <notting@splat.cc> | 2015-07-27 11:02:24 -0400 |
commit | 69deab1786aa0bcfd0347bb4c33a92eabd47170b (patch) | |
tree | d74b120888e0468958bf261b763cdc1b8f60f01b /commands/command.py | |
parent | 2bfddb015d2d5d162647957c31431baf30a30938 (diff) | |
download | ansible-modules-core-69deab1786aa0bcfd0347bb4c33a92eabd47170b.tar.gz |
Warn on use of sudo, etc. in shell/command.
Diffstat (limited to 'commands/command.py')
-rw-r--r-- | commands/command.py | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/commands/command.py b/commands/command.py index dbb23949..b703c669 100644 --- a/commands/command.py +++ b/commands/command.py @@ -144,12 +144,15 @@ def check_command(commandline): 'mount': 'mount', 'rpm': 'yum', 'yum': 'yum', 'apt-get': 'apt-get', 'tar': 'unarchive', 'unzip': 'unarchive', 'sed': 'template or lineinfile', 'rsync': 'synchronize' } + become = [ 'sudo', 'su', 'pbrun', 'pfexec', 'runas' ] warnings = list() command = os.path.basename(commandline.split()[0]) if command in arguments: warnings.append("Consider using file module with %s rather than running %s" % (arguments[command], command)) if command in commands: warnings.append("Consider using %s module rather than running %s" % (commands[command], command)) + if command in become: + warnings.append("Consider using 'become', 'become_method', and 'become_user' rather than running %s" % (command,)) return warnings |