diff --git a/awx/ui/static/js/controllers/Credentials.js b/awx/ui/static/js/controllers/Credentials.js index 600633359d..cb2a355cef 100644 --- a/awx/ui/static/js/controllers/Credentials.js +++ b/awx/ui/static/js/controllers/Credentials.js @@ -158,6 +158,21 @@ export function CredentialsAdd($scope, $rootScope, $compile, $location, $log, $r variable: 'credential_kind_options' }); + // GetChoices({ + // scope: $scope, + // url: defaultUrl, + // field: 'become', + // variable: 'become_options' + // }); + + $scope.become_options = [ + { value: 'sudo', label: 'Sudo' }, + { value: 'su', label: 'Su' }, + { value: 'pbrun', label: 'Pbrun'}, + { value: 'pfexec', label: 'Pfexec'}, + { value: 'runas', label: 'Runas'} + ]; + LookUpInit({ scope: $scope, form: form, @@ -314,7 +329,13 @@ export function CredentialsEdit($scope, $rootScope, $compile, $location, $log, $ generator.inject(form, { mode: 'edit', related: true, scope: $scope }); generator.reset(); $scope.id = id; - + $scope.become_options = [ + { value: 'sudo', label: 'Sudo' }, + { value: 'su', label: 'Su' }, + { value: 'pbrun', label: 'Pbrun'}, + { value: 'pfexec', label: 'Pfexec'}, + { value: 'runas', label: 'Runas'} + ]; function setAskCheckboxes() { var fld, i; for (fld in form.fields) { diff --git a/awx/ui/static/js/forms/Credentials.js b/awx/ui/static/js/forms/Credentials.js index a5aa5c13dc..ab5c578b50 100644 --- a/awx/ui/static/js/forms/Credentials.js +++ b/awx/ui/static/js/forms/Credentials.js @@ -274,27 +274,13 @@ export default hasShowInputButton: true, askShow: "kind.value == 'ssh'", // Only allow ask for machine credentials }, - "login_method": { - label: "Privilege Escalation Credential", + "become_method": { + label: "Privilege Escalation", hintText: "If your playbooks use privilege escalation (\"sudo: true\", \"su: true\", etc), you can specify the username to become, and the password to use here.", type: 'select', ngShow: "kind.value == 'ssh'", ngChange: "loginMethodChange()", - ngOptions: 'kind.label for kind in credential_kind_options track by kind.value', - // options: [{ - // label: 'None', // FIXME: Maybe 'Default' or 'SSH only' instead? - // value: '', - // selected: true - // }, { - // label: 'Sudo', - // value: 'sudo' - // }, { - // label: 'Su', - // value: 'su' - // },{ - // label: 'Pbrun', - // value: 'pbrun' - // }], + ngOptions: 'become.label for become in become_options track by become.value', awPopOver: "
Sudo: Optionally specify a username for sudo operations. "+
"This is equivalent to specifying the ansible-playbook --sudo-user parameter.
" +
"Su: Optionally specify a username for su operations. This is equivalent to specifying the ansible-playbook --su-user parameter.
"+
@@ -303,54 +289,18 @@ export default
dataPlacement: 'right',
dataContainer: "body"
},
- "sudo_username": {
- label: 'Sudo Username',
+ "become_username": {
+ label: 'Privilege Escalation Username',
type: 'text',
- ngShow: "kind.value == 'ssh' && login_method == 'sudo'",
+ ngShow: "kind.value == 'ssh' && become_method",
addRequired: false,
editRequired: false,
autocomplete: false
},
- "sudo_password": {
- label: 'Sudo Password',
+ "become_password": {
+ label: 'Privilege Escalation Password',
type: 'sensitive',
- ngShow: "kind.value == 'ssh' && login_method == 'sudo'",
- addRequired: false,
- editRequired: false,
- ask: true,
- hasShowInputButton: true,
- autocomplete: false
- },
- "su_username": {
- label: 'Su Username',
- type: 'text',
- ngShow: "kind.value == 'ssh' && login_method == 'su'",
- addRequired: false,
- editRequired: false,
- autocomplete: false
- },
- "su_password": {
- label: 'Su Password',
- type: 'sensitive',
- ngShow: "kind.value == 'ssh' && login_method == 'su'",
- addRequired: false,
- editRequired: false,
- ask: true,
- hasShowInputButton: true,
- autocomplete: false
- },
- "pbrun_username": {
- label: 'Pbrun Username',
- type: 'text',
- ngShow: "kind.value == 'ssh' && login_method == 'pbrun'",
- addRequired: false,
- editRequired: false,
- autocomplete: false
- },
- "pbrun_password": {
- label: 'Pbrun Password',
- type: 'sensitive',
- ngShow: "kind.value == 'ssh' && login_method == 'pbrun'",
+ ngShow: "kind.value == 'ssh' && become_method",
addRequired: false,
editRequired: false,
ask: true,