mirror of
https://github.com/ansible/awx.git
synced 2026-01-12 18:40:01 -03:30
fill in api browser with needed extra_vars passwords and credential
This commit is contained in:
parent
086ae8f9ad
commit
90037bbc2f
@ -1706,6 +1706,17 @@ class JobLaunchSerializer(BaseSerializer):
|
||||
read_only_fields = ('ask_variables_on_launch',)
|
||||
write_only_fields = ('credential','extra_vars',)
|
||||
|
||||
def to_native(self, obj):
|
||||
res = super(JobLaunchSerializer, self).to_native(obj)
|
||||
view = self.context.get('view', None)
|
||||
if hasattr(view, '_raw_data_form_marker'):
|
||||
if obj.passwords_needed_to_start:
|
||||
password_keys = dict([(p, u'') for p in obj.passwords_needed_to_start])
|
||||
res.update(dict(extra_vars=password_keys))
|
||||
if self.get_credential_needed_to_start(obj) is True:
|
||||
res.update(dict(credential=''))
|
||||
return res
|
||||
|
||||
def get_credential_needed_to_start(self, obj):
|
||||
return not (obj and obj.credential and obj.credential.active)
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user