mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-08 22:33:25 +00:00
Allow generic django_management commands
This commit removes the restriction on django management commands. If a command is unknown to the django installation, there will be a concise error produced.
for example:
tasks:
- name: invalid command
django_manage: virtualenv="/valid/virtualenv" app_path="/valid/app_path" command="nowaydude"
Results in:
failed: [hostname] => {"cmd": "python manage.py nowaydude", "failed": true}
msg: stdout: Unknown command: 'nowaydude'
Type 'manage.py help' for usage.
:stderr: Unknown django command: nowaydude
This commit is contained in:
@@ -192,7 +192,7 @@ def main():
|
|||||||
|
|
||||||
module = AnsibleModule(
|
module = AnsibleModule(
|
||||||
argument_spec=dict(
|
argument_spec=dict(
|
||||||
command = dict(default=None, required=True, choices=command_allowed_param_map.keys()),
|
command = dict(default=None, required=True),
|
||||||
app_path = dict(default=None, required=True),
|
app_path = dict(default=None, required=True),
|
||||||
settings = dict(default=None, required=False),
|
settings = dict(default=None, required=False),
|
||||||
pythonpath = dict(default=None, required=False, aliases=['python_path']),
|
pythonpath = dict(default=None, required=False, aliases=['python_path']),
|
||||||
@@ -254,6 +254,8 @@ def main():
|
|||||||
if command == 'createcachetable' and 'table' in err and 'already exists' in err:
|
if command == 'createcachetable' and 'table' in err and 'already exists' in err:
|
||||||
out = 'Already exists.'
|
out = 'Already exists.'
|
||||||
else:
|
else:
|
||||||
|
if "Unknown command:" in err:
|
||||||
|
_fail(module, cmd, err, "Unknown django command: %s" % command)
|
||||||
_fail(module, cmd, out, err, path=os.environ["PATH"], syspath=sys.path)
|
_fail(module, cmd, out, err, path=os.environ["PATH"], syspath=sys.path)
|
||||||
|
|
||||||
changed = False
|
changed = False
|
||||||
|
|||||||
Reference in New Issue
Block a user