type: update name: Load admins description: Testing grounds for dynamically loading admins from the CP[0] node. targetNodes: nodeGroup: cp settings: configure: fields: - type: string name: userToLoginAs caption: User to login as placeholder: Enter user ID, user email, or user login default: 1 actions: save_config: #empty method to allow userToLoginAs to save # lookup user that was entered cmd [cp]: - cd /var/www/webroot/ROOT/ - user=$(wp user get ${settings.userToLoginAs} --field=ID) # see if number (user ID) returned or not. Return 1 if yes. - re='^[0-9]+$' - if ! [[ $user =~ $re ]]; then echo 0; else echo 1; fi #check if the user was found # returns ID if so # returns 'Error: Invalid user ID, email or login: '24342'' if (response.out == 0): script: | return {"result": "error", "message": "User not found. Try again."} else: script: | return {"result": "success", "message": "User saved!"} buttons: - caption: Configure settings: configure action: save_config # can't seem to get the field to save unless it's input during admin