mirror of
https://github.com/ansible/awx.git
synced 2026-01-13 19:10:07 -03:30
Perform type checking on module_name and args for ad-hoc commands to
satisfy qa.
This commit is contained in:
parent
79a8e541cd
commit
22ecb62179
@ -101,12 +101,16 @@ class AdHocCommand(UnifiedJob):
|
||||
return self.limit
|
||||
|
||||
def clean_module_name(self):
|
||||
if type(self.module_name) not in (str, unicode):
|
||||
raise ValidationError("Invalid type for ad hoc command")
|
||||
module_name = self.module_name.strip() or 'command'
|
||||
if module_name not in settings.AD_HOC_COMMANDS:
|
||||
raise ValidationError('Unsupported module for ad hoc commands.')
|
||||
return module_name
|
||||
|
||||
def clean_module_args(self):
|
||||
if type(self.module_args) not in (str, unicode):
|
||||
raise ValidationError("Invalid type for ad hoc command")
|
||||
module_args = self.module_args
|
||||
if self.module_name in ('command', 'shell') and not module_args:
|
||||
raise ValidationError('No argument passed to %s module.' % self.module_name)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user