MichaelSasser / matrixctl

Control, manage, provision and deploy your matrix homeserver.
https://matrixctl.rtfd.io
GNU General Public License v3.0
11 stars 1 forks source link

[BUG] adduser --ansible does not work #1

Closed MichaelSasser closed 4 years ago

MichaelSasser commented 4 years ago

Describe the bug

  1. adduser --ansible username throws an error when generating password because of \'` .
  2. adduser --ansible does not work

To Reproduce Steps to reproduce the behavior:

  1. Enter command 'adduser --ansible username
  2. Enter or autogenerate pasword
  3. Press "y" [ENTER]
  4. See error

Expected behavior Added user like the API version of that command.

Debug output

2020-04-13 09:18:36 - DEBUG - Loading Config file(s)
2020-04-13 09:18:36 - DEBUG - [ANSIBLE]
2020-04-13 09:18:36 - DEBUG -   ├─  matrixdockeransibledeploypath := /home/michael/repos/playbooks/synapse/matrix-docker-ansible-deploy
2020-04-13 09:18:36 - DEBUG -   ┴
2020-04-13 09:18:36 - DEBUG - [SERVER]
2020-04-13 09:18:36 - DEBUG -   ├─  ansiblecfg := /home/michael/repos/playbooks/matrix/ansible.cfg
2020-04-13 09:18:36 - DEBUG -   ├─  ansibleplaybook := /home/michael/repos/playbooks/matrix/site.yml
2020-04-13 09:18:36 - DEBUG -   ├─  ansibletags := setup-all
2020-04-13 09:18:36 - DEBUG -   ┴
2020-04-13 09:18:36 - DEBUG - [API]
2020-04-13 09:18:36 - DEBUG -   ├─  domain := michaelsasser.org
2020-04-13 09:18:36 - DEBUG -   ├─  token := **HIDDEN (Length=284)**
2020-04-13 09:18:36 - DEBUG -   ┴
2020-04-13 09:18:36 - DEBUG - args=Namespace(admin=False, ansible=True, debug=True, func=<function adduser at 0x7f01460095e0>, passwd=None, user='myuser')
2020-04-13 09:18:36 - DEBUG - Disabing help on AttributeError
2020-04-13 09:18:36 - WARNING - In debugging mode help is disabled! If you don't use any attibutes, the program will throw a AttributeError like: "AttributeError: 'Namespace' object has no attribute 'func".' This is perfectly normal and not a bug. If you want the help in debug mode, use the "--help" attribute.
Username: myuser
Password (generated): t7D9^P82|;r17jXC
Admin:    no
Is everything ok? [y/n]
PLAY [Set up a Matrix server] *****************************************************************************************************************************************************************************************************

TASK [Gathering Facts] ************************************************************************************************************************************************************************************************************
[WARNING]: Platform linux on host matrix.michaelsasser.org is using the discovered Python interpreter at /usr/bin/python, but future installation of another Python interpreter could change this. See
https://docs.ansible.com/ansible/2.9/reference_appendices/interpreter_discovery.html for more information.
ok: [matrix.michaelsasser.org]

TASK [matrix-base : set_fact] *****************************************************************************************************************************************************************************************************
ok: [matrix.michaelsasser.org]

TASK [matrix-base : Fail if running on Ansible < 2.5] *****************************************************************************************************************************************************************************
skipping: [matrix.michaelsasser.org]

TASK [matrix-base : Fail if running on Ansible 2.5.x (lower than 2.5.2)] **********************************************************************************************************************************************************
skipping: [matrix.michaelsasser.org]

TASK [matrix-base : (Deprecation) Catch and report renamed settings] **************************************************************************************************************************************************************
skipping: [matrix.michaelsasser.org] => (item={'old': 'host_specific_hostname_identity', 'new': 'matrix_domain'}) 
skipping: [matrix.michaelsasser.org] => (item={'old': 'hostname_identity', 'new': 'matrix_domain'}) 
skipping: [matrix.michaelsasser.org] => (item={'old': 'hostname_matrix', 'new': 'matrix_server_fqn_matrix'}) 
skipping: [matrix.michaelsasser.org] => (item={'old': 'hostname_riot', 'new': 'matrix_server_fqn_riot'}) 

TASK [matrix-base : Fail if required variables are undefined] *********************************************************************************************************************************************************************
skipping: [matrix.michaelsasser.org] => (item=matrix_domain) 
skipping: [matrix.michaelsasser.org] => (item=matrix_server_fqn_matrix) 
skipping: [matrix.michaelsasser.org] => (item=matrix_server_fqn_riot) 

TASK [matrix-base : Fail if uppercase domain used] ********************************************************************************************************************************************************************************
skipping: [matrix.michaelsasser.org] => (item=michaelsasser.org) 
skipping: [matrix.michaelsasser.org] => (item=matrix.michaelsasser.org) 
skipping: [matrix.michaelsasser.org] => (item=riot.michaelsasser.org) 

TASK [matrix-base : Fail if using python2 on Archlinux] ***************************************************************************************************************************************************************************
skipping: [matrix.michaelsasser.org]

TASK [matrix-mailer : set_fact] ***************************************************************************************************************************************************************************************************
ok: [matrix.michaelsasser.org]

TASK [matrix-postgres : set_fact] *************************************************************************************************************************************************************************************************
ok: [matrix.michaelsasser.org]

TASK [matrix-corporal : set_fact] *************************************************************************************************************************************************************************************************
skipping: [matrix.michaelsasser.org]

TASK [matrix-bridge-appservice-discord : Fail if matrix-synapse role already executed] ********************************************************************************************************************************************
skipping: [matrix.michaelsasser.org]

TASK [matrix-bridge-appservice-discord : set_fact] ********************************************************************************************************************************************************************************
ok: [matrix.michaelsasser.org]

TASK [matrix-bridge-appservice-discord : set_fact] ********************************************************************************************************************************************************************************
ok: [matrix.michaelsasser.org]

TASK [matrix-bridge-appservice-slack : Fail if matrix-synapse role already executed] **********************************************************************************************************************************************
skipping: [matrix.michaelsasser.org]

TASK [matrix-bridge-appservice-slack : set_fact] **********************************************************************************************************************************************************************************
ok: [matrix.michaelsasser.org]

TASK [matrix-bridge-appservice-slack : set_fact] **********************************************************************************************************************************************************************************
ok: [matrix.michaelsasser.org]

TASK [matrix-bridge-appservice-slack : Fail if matrix-synapse role already executed] **********************************************************************************************************************************************
skipping: [matrix.michaelsasser.org]

TASK [matrix-bridge-appservice-slack : Fail if matrix-nginx-proxy role already executed] ******************************************************************************************************************************************
skipping: [matrix.michaelsasser.org]

TASK [matrix-bridge-appservice-slack : Generate Matrix Appservice Slack proxying configuration for matrix-nginx-proxy] ************************************************************************************************************
ok: [matrix.michaelsasser.org]

TASK [matrix-bridge-appservice-slack : Register Slack Appservice proxying configuration with matrix-nginx-proxy] ******************************************************************************************************************
ok: [matrix.michaelsasser.org]

TASK [matrix-bridge-appservice-slack : Warn about reverse-proxying if matrix-nginx-proxy not used] ********************************************************************************************************************************
skipping: [matrix.michaelsasser.org]

TASK [matrix-bridge-appservice-webhooks : Fail if matrix-synapse role already executed] *******************************************************************************************************************************************
skipping: [matrix.michaelsasser.org]

TASK [matrix-bridge-appservice-webhooks : set_fact] *******************************************************************************************************************************************************************************
skipping: [matrix.michaelsasser.org]

TASK [matrix-bridge-appservice-webhooks : set_fact] *******************************************************************************************************************************************************************************
skipping: [matrix.michaelsasser.org]

TASK [matrix-bridge-appservice-webhooks : Fail if matrix-synapse role already executed] *******************************************************************************************************************************************
skipping: [matrix.michaelsasser.org]

TASK [matrix-bridge-appservice-webhooks : Fail if matrix-nginx-proxy role already executed] ***************************************************************************************************************************************
skipping: [matrix.michaelsasser.org]

TASK [matrix-bridge-appservice-webhooks : Generate Matrix Appservice webhooks proxying configuration for matrix-nginx-proxy] ******************************************************************************************************
skipping: [matrix.michaelsasser.org]

TASK [matrix-bridge-appservice-webhooks : Register webhooks Appservice proxying configuration with matrix-nginx-proxy] ************************************************************************************************************
skipping: [matrix.michaelsasser.org]

TASK [matrix-bridge-appservice-webhooks : Warn about reverse-proxying if matrix-nginx-proxy not used] *****************************************************************************************************************************
skipping: [matrix.michaelsasser.org]

TASK [matrix-bridge-appservice-irc : Fail if matrix-synapse role already executed] ************************************************************************************************************************************************
skipping: [matrix.michaelsasser.org]

TASK [matrix-bridge-appservice-irc : set_fact] ************************************************************************************************************************************************************************************
skipping: [matrix.michaelsasser.org]

TASK [matrix-bridge-appservice-irc : set_fact] ************************************************************************************************************************************************************************************
skipping: [matrix.michaelsasser.org]

TASK [matrix-bridge-mautrix-facebook : set_fact] **********************************************************************************************************************************************************************************
skipping: [matrix.michaelsasser.org]

TASK [matrix-bridge-mautrix-facebook : set_fact] **********************************************************************************************************************************************************************************
skipping: [matrix.michaelsasser.org]

TASK [matrix-bridge-mautrix-facebook : Fail if running on Ansible lower than 2.8 and trying self building] ************************************************************************************************************************
skipping: [matrix.michaelsasser.org]

TASK [matrix-bridge-mautrix-hangouts : set_fact] **********************************************************************************************************************************************************************************
ok: [matrix.michaelsasser.org]

TASK [matrix-bridge-mautrix-hangouts : set_fact] **********************************************************************************************************************************************************************************
ok: [matrix.michaelsasser.org]

TASK [matrix-bridge-mautrix-hangouts : Fail if matrix-nginx-proxy role already executed] ******************************************************************************************************************************************
skipping: [matrix.michaelsasser.org]

TASK [matrix-bridge-mautrix-hangouts : Generate Mautrix Hangouts proxying configuration for matrix-nginx-proxy] *******************************************************************************************************************
ok: [matrix.michaelsasser.org]

TASK [matrix-bridge-mautrix-hangouts : Register Mautrix Hangouts proxying configuration with matrix-nginx-proxy] ******************************************************************************************************************
ok: [matrix.michaelsasser.org]

TASK [matrix-bridge-mautrix-hangouts : Warn about reverse-proxying if matrix-nginx-proxy not used] ********************************************************************************************************************************
skipping: [matrix.michaelsasser.org]

TASK [matrix-bridge-mautrix-hangouts : Fail if running on Ansible lower than 2.8 and trying self building] ************************************************************************************************************************
skipping: [matrix.michaelsasser.org]

TASK [matrix-bridge-mautrix-telegram : set_fact] **********************************************************************************************************************************************************************************
ok: [matrix.michaelsasser.org]

TASK [matrix-bridge-mautrix-telegram : set_fact] **********************************************************************************************************************************************************************************
ok: [matrix.michaelsasser.org]

TASK [matrix-bridge-mautrix-telegram : Fail if matrix-nginx-proxy role already executed] ******************************************************************************************************************************************
skipping: [matrix.michaelsasser.org]

TASK [matrix-bridge-mautrix-telegram : Generate Mautrix Telegram proxying configuration for matrix-nginx-proxy] *******************************************************************************************************************
ok: [matrix.michaelsasser.org]

TASK [matrix-bridge-mautrix-telegram : Register Mautrix Telegram proxying configuration with matrix-nginx-proxy] ******************************************************************************************************************
ok: [matrix.michaelsasser.org]

TASK [matrix-bridge-mautrix-telegram : Warn about reverse-proxying if matrix-nginx-proxy not used] ********************************************************************************************************************************
skipping: [matrix.michaelsasser.org]

TASK [matrix-bridge-mautrix-whatsapp : set_fact] **********************************************************************************************************************************************************************************
ok: [matrix.michaelsasser.org]

TASK [matrix-bridge-mautrix-whatsapp : set_fact] **********************************************************************************************************************************************************************************
ok: [matrix.michaelsasser.org]

TASK [matrix-bridge-mx-puppet-skype : set_fact] ***********************************************************************************************************************************************************************************
ok: [matrix.michaelsasser.org]

TASK [matrix-bridge-mx-puppet-skype : set_fact] ***********************************************************************************************************************************************************************************
ok: [matrix.michaelsasser.org]

TASK [matrix-bridge-mx-puppet-skype : Fail if running on Ansible lower than 2.8 and trying self building] *************************************************************************************************************************
skipping: [matrix.michaelsasser.org]

TASK [matrix-synapse : set_fact] **************************************************************************************************************************************************************************************************
ok: [matrix.michaelsasser.org]

TASK [matrix-synapse : set_fact] **************************************************************************************************************************************************************************************************
skipping: [matrix.michaelsasser.org]

TASK [matrix-synapse : Fail if running on Ansible lower than 2.8 and trying self building] ****************************************************************************************************************************************
skipping: [matrix.michaelsasser.org]

TASK [matrix-synapse : Fail if playbook called incorrectly] ***********************************************************************************************************************************************************************
fatal: [matrix.michaelsasser.org]: FAILED! => {"changed": false, "msg": "The `username` variable needs to be provided to this playbook, via --extra-vars"}

PLAY RECAP ************************************************************************************************************************************************************************************************************************
matrix.michaelsasser.org   : ok=23   changed=0    unreachable=0    failed=1    skipped=34   rescued=0    ignored=0   

Traceback (most recent call last):
  File "/home/michael/.cache/pypoetry/virtualenvs/matrixctl-bgeLX2r0-py3.8/bin/matrixctl", line 11, in <module>
    load_entry_point('matrixctl', 'console_scripts', 'matrixctl')()
  File "/home/michael/repos/matrixctl/matrixctl/application.py", line 194, in main
    args.func(args, config, api)
  File "/home/michael/repos/matrixctl/matrixctl/account.py", line 103, in adduser
    ansible_synapse(
  File "/home/michael/repos/matrixctl/matrixctl/ansible_handler.py", line 65, in ansible_synapse
    subprocess.run(cmd, check=True)
  File "/usr/lib/python3.8/subprocess.py", line 512, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['ansible-playbook', '-i', '/home/michael/repos/playbooks/synapse/matrix-docker-ansible-deploy/inventory/hosts', '/home/michael/repos/playbooks/synapse/matrix-docker-ansible-deploy/setup.yml', "--extra-vars='username=myuser password=t7D9^P82|;r17jXC admin=False'", '--tags=register-user']' returned non-zero exit status 2.

Desktop (please complete the following information):

Additional context None

MichaelSasser commented 4 years ago

Fixed