Fix main file error

main
Anthony 2023-11-03 01:34:23 +08:00
parent 0a3128745e
commit f862cc4758
1 changed files with 3 additions and 15 deletions

View File

@ -70,21 +70,9 @@ menu:
actions:
add_sftp_user:
- cmd[cp]: # Use cmd action to check if user exists
commands: id ${globals.username} || echo "User not found"
- if ("${response.out}" == "User not found"): # If user doesn't exist
- cmd[cp]:
user: root
commands: bash /home/jelastic/add-sftp-user-addon/add-sftp.sh ${globals.username} ${globals.password}
- if ("${response.exitStatus}" != "0"):
return: createUserError
- else:
- setGlobals:
username: "user${fn.random(10000,99999)}"
- cmd[cp]: # Check again with the new username
commands: id ${globals.username} || echo "User not found"
- if ("${response.out}" != "User not found"):
return: userExistsError
- cmd[cp]:
user: root
commands: bash /home/jelastic/add-sftp-user-addon/add-sftp.sh ${globals.username} ${globals.password}
- return: sftpSuccess
change_password:
- cmd[cp]: