Upgrade 18.03 to 19.1x (pelican-stretch)

Hello!

I’m unable to upgrade my wazo (18.03) to 19.12 (or other version in 19.1x)

The commands I execute :

wazo-dist pelican-stretch
LANG=C
wazo-upgrade

After this i have severals errors :

root@pvoiall001:~# wazo-upgrade
Upgrading wazo-upgrade
Reading package lists...
Building dependency tree...
Reading state information...
xivo-upgrade is already the newest version (19.14~20190925.180051.ce3a5c8.deb9).
0 upgraded, 0 newly installed, 0 to remove and 89 not upgraded.
Switching to pelican-stretch distribution
Reading package lists...
Building dependency tree...
Reading state information...
xivo-dist is already the newest version (19.13~20190912.194304.99cafb1.deb9).
0 upgraded, 0 newly installed, 0 to remove and 89 not upgraded.
installed version : 18.03
proposed update : 19.12

Asterisk will be upgraded from version 15 to 16. You might be impacted if you have:

* custom Asterisk configuration (other than custom dialplan)
* custom application using AMI or ARI
* custom Asterisk modules (e.g. codec_g729a.so)

If you find yourself in one of these cases, you should make sure that
your customizations still work with Asterisk 16. Please refer to
http://documentation.wazo.community/en/stable/upgrade/18.12/asterisk_16.html
for more information.

Would you like to upgrade your system (all services will be restarted) [Y/n]? Y

Created symlink /etc/systemd/system/multi-user.target.wants/wazo-provd.service → /lib/systemd/system/wazo-provd.service.
Job for wazo-provd.service failed because of unavailable resources or another system error.
See “systemctl status wazo-provd.service” and “journalctl -xe” for details.
wazo-provd.service couldn’t start.

Created symlink /etc/systemd/system/multi-user.target.wants/wazo-agid.service → /lib/systemd/system/wazo-agid.service.
Job for wazo-agid.service failed because the control process exited with error code.
See “systemctl status wazo-agid.service” and “journalctl -xe” for details.
wazo-agid.service couldn’t start.

Created symlink /etc/systemd/system/multi-user.target.wants/wazo-dird.service → /lib/systemd/system/wazo-dird.service.
Job for wazo-dird.service failed because the control process exited with error code.
See “systemctl status wazo-dird.service” and “journalctl -xe” for details.
wazo-dird.service couldn’t start.

Could not read config file /var/lib/wazo-auth-keys/wazo-chatd-key.yml: [Errno 2] No such file or directory: ‘/var/lib/wazo-auth-keys/wazo-chatd-key.yml’

Created symlink /etc/systemd/system/multi-user.target.wants/wazo-agentd.service → /lib/systemd/system/wazo-agentd.service.
Job for wazo-agentd.service failed because the control process exited with error code.
See “systemctl status wazo-agentd.service” and “journalctl -xe” for details.
wazo-agentd.service couldn’t start.
Setting up wazo-calld (19.12~20190822.163516.b4fb728.deb9) …
Created symlink /etc/systemd/system/multi-user.target.wants/wazo-calld.service → /lib/systemd/system/wazo-calld.service.
Job for wazo-calld.service failed because the control process exited with error code.
See “systemctl status wazo-calld.service” and “journalctl -xe” for details.
wazo-calld.service couldn’t start.
Setting up wazo-phoned (19.12~20190814.201749.827e37b.deb9) …
Created symlink /etc/systemd/system/multi-user.target.wants/wazo-phoned.service → /lib/systemd/system/wazo-phoned.service.
Job for wazo-phoned.service failed because the control process exited with error code.
See “systemctl status wazo-phoned.service” and “journalctl -xe” for details.
wazo-phoned.service couldn’t start.

Executing upgrade script /usr/share/xivo-upgrade/pre-start.d/00-run-xivo-check-db…
Checking database…
NOK (current revision is 28443bfc4fb1)
Executing upgrade script /usr/share/xivo-upgrade/pre-start.d/000-wazo-update-keys…
401 Client Error: UNAUTHORIZED for url: https://localhost:9497/0.1/token
401 Client Error: UNAUTHORIZED for url: https://localhost:9497/0.1/token
Executing upgrade script /usr/share/xivo-upgrade/pre-start.d/001-update-database-until-entity-tenant.sh…
Executing upgrade script /usr/share/xivo-upgrade/pre-start.d/002-create-tenants-from-entities.py…
Could not read config file /var/lib/wazo-auth-keys/wazo-upgrade-key.yml: [Errno 2] No such file or directory: ‘/var/lib/wazo-auth-keys/wazo-upgrade-key.yml’
Traceback (most recent call last):
File “/usr/share/xivo-upgrade/pre-start.d/002-create-tenants-from-entities.py”, line 128, in
main()
File “/usr/share/xivo-upgrade/pre-start.d/002-create-tenants-from-entities.py”, line 120, in main
config = _load_config()
File “/usr/share/xivo-upgrade/pre-start.d/002-create-tenants-from-entities.py”, line 24, in _load_config
key_config = _load_key_file(ChainMap(file_config, _DEFAULT_CONFIG))
File “/usr/share/xivo-upgrade/pre-start.d/002-create-tenants-from-entities.py”, line 30, in _load_key_file
return {‘auth’: {‘username’: key_file[‘service_id’],
KeyError: ‘service_id’

Executing upgrade script /usr/share/xivo-upgrade/pre-start.d/02-run-xivo-update-config...
Updating Wazo config
Traceback (most recent call last):
  File "/usr/sbin/xivo-create-config", line 192, in <module>
    main()
  File "/usr/sbin/xivo-create-config", line 41, in main
    config = load_config()
  File "/usr/sbin/xivo-create-config", line 49, in load_config
    result.update(load_config_dhcp(session))
  File "/usr/sbin/xivo-create-config", line 63, in load_config_dhcp
    Dhcp.network_interfaces,
  File "/usr/lib/python2.7/dist-packages/sqlalchemy/orm/query.py", line 2659, in first
    ret = list(self[0:1])
  File "/usr/lib/python2.7/dist-packages/sqlalchemy/orm/query.py", line 2457, in __getitem__
    return list(res)
  File "/usr/lib/python2.7/dist-packages/sqlalchemy/orm/query.py", line 2761, in __iter__
    return self._execute_and_instances(context)
  File "/usr/lib/python2.7/dist-packages/sqlalchemy/orm/query.py", line 2776, in _execute_and_instances
    result = conn.execute(querycontext.statement, self._params)
  File "/usr/lib/python2.7/dist-packages/sqlalchemy/engine/base.py", line 914, in execute
    return meth(self, multiparams, params)
  File "/usr/lib/python2.7/dist-packages/sqlalchemy/sql/elements.py", line 323, in _execute_on_connection
    return connection._execute_clauseelement(self, multiparams, params)
  File "/usr/lib/python2.7/dist-packages/sqlalchemy/engine/base.py", line 1010, in _execute_clauseelement
    compiled_sql, distilled_params
  File "/usr/lib/python2.7/dist-packages/sqlalchemy/engine/base.py", line 1146, in _execute_context
    context)
  File "/usr/lib/python2.7/dist-packages/sqlalchemy/engine/base.py", line 1341, in _handle_dbapi_exception
    exc_info
  File "/usr/lib/python2.7/dist-packages/sqlalchemy/util/compat.py", line 202, in raise_from_cause
    reraise(type(exception), exception, tb=exc_tb, cause=cause)
  File "/usr/lib/python2.7/dist-packages/sqlalchemy/engine/base.py", line 1139, in _execute_context
    context)
  File "/usr/lib/python2.7/dist-packages/sqlalchemy/engine/default.py", line 450, in do_execute
    cursor.execute(statement, parameters)
sqlalchemy.exc.ProgrammingError: (psycopg2.ProgrammingError) column dhcp.network_interfaces does not exist
LINE 1: ... dhcp_pool_start, dhcp.pool_end AS dhcp_pool_end, dhcp.netwo...
                                                             ^
 [SQL: 'SELECT dhcp.active AS dhcp_active, dhcp.pool_start AS dhcp_pool_start, dhcp.pool_end AS dhcp_pool_end, dhcp.network_interfaces AS dhcp_network_interfaces \nFROM dhcp \n LIMIT %(param_1)s'] [parameters: {'param_1': 1}]
Generating configuration
ERROR: generation from template 'dhcp' failed because all variables could not be expanded:
subnet #XIVO_DHCP_NET4_SUBNET# netmask #XIVO_DHCP_NET4_NETMASK# { /tmp/tmp.jP2Wm23Onx/dhcp/etc/dhcp/dhcpd_subnet.conf.head: option subnet-mask #XIVO_DHCP_NET4_NETMASK#; /tmp/tmp.jP2Wm23Onx/dhcp/etc/dhcp/dhcpd_subnet.conf.head: option routers #XIVO_DHCP_NET4_IP#;
'mail' configuration OK, skipping.
'system' configuration OK, skipping.
DONE
Executing upgrade script /usr/share/xivo-upgrade/pre-start.d/55-fix-service-discovery...
Executing upgrade script /usr/share/xivo-upgrade/pre-start.d/fix_paths_rights.sh...
Executing upgrade script /usr/share/xivo-upgrade/pre-start.d/fix_twisted_reactor...
Enabling Wazo services...
Closing port 5060.
Waiting for services to stop successfully...
Waiting for services to start successfully...
        starting dahdi ... OK
        starting wazo-plugind ... OK
        starting wazo-webhookd ... OK
        starting xivo-sysconfd ... OK
        starting xivo-confgend ... OK
        starting wazo-confd ... OK
        starting wazo-auth ... OK
        starting xivo-dxtora ... OK
        starting wazo-provd ... OK
        starting wazo-agid ...Job for wazo-agid.service failed because the control process exited with error code.
See "systemctl status wazo-agid.service" and "journalctl -xe" for details.
 NOK
Opening port 5060.
Executing upgrade script /usr/share/xivo-upgrade/post-start.d/09_provd_add_phonebook_ip.sh...
Could not read config file /var/lib/wazo-auth-keys/wazo-provd-cli-key.yml: [Errno 2] No such file or directory: '/var/lib/wazo-auth-keys/wazo-provd-cli-key.yml'
Traceback (most recent call last):
  File "/usr/bin/wazo-provd-cli", line 3, in <module>
    from wazo_provd_cli import cli
  File "/usr/lib/python2.7/dist-packages/wazo_provd_cli/cli.py", line 89, in <module>
    auth_client = AuthClient(username=key_file['service_id'], password=key_file['service_key'], **_CONFIG['auth'])
KeyError: 'service_id'
Executing upgrade script /usr/share/xivo-upgrade/post-start.d/18_upgrade_official_plugins.py...
Could not read config file /var/lib/wazo-auth-keys/wazo-upgrade-key.yml: [Errno 2] No such file or directory: '/var/lib/wazo-auth-keys/wazo-upgrade-key.yml'
Traceback (most recent call last):
  File "/usr/share/xivo-upgrade/post-start.d/18_upgrade_official_plugins.py", line 58, in <module>
    main()
  File "/usr/share/xivo-upgrade/post-start.d/18_upgrade_official_plugins.py", line 38, in main
    config = load_config()
  File "/usr/share/xivo-upgrade/post-start.d/18_upgrade_official_plugins.py", line 27, in load_config
    key_config = _load_key_file(ChainMap(file_config, _DEFAULT_CONFIG))
  File "/usr/share/xivo-upgrade/post-start.d/18_upgrade_official_plugins.py", line 33, in _load_key_file
    return {'auth': {'username': key_file['service_id'],
KeyError: 'service_id'
Executing upgrade script /usr/share/xivo-upgrade/post-start.d/20_reset_unassociated_devices_to_autoprov...
Could not read config file /var/lib/wazo-auth-keys/wazo-upgrade-key.yml: [Errno 2] No such file or directory: '/var/lib/wazo-auth-keys/wazo-upgrade-key.yml'
Traceback (most recent call last):
  File "/usr/share/xivo-upgrade/post-start.d/20_reset_unassociated_devices_to_autoprov", line 34, in <module>
    config = load_config()
  File "/usr/share/xivo-upgrade/post-start.d/20_reset_unassociated_devices_to_autoprov", line 24, in load_config
    key_config = _load_key_file(ChainMap(file_config, _DEFAULT_CONFIG))
  File "/usr/share/xivo-upgrade/post-start.d/20_reset_unassociated_devices_to_autoprov", line 30, in _load_key_file
    return {'auth': {'username': key_file['service_id'],
KeyError: 'service_id'
Executing upgrade script /usr/share/xivo-upgrade/post-start.d/25_dird_tenant_migration.py...
Could not read config file /var/lib/wazo-auth-keys/wazo-upgrade-key.yml: [Errno 2] No such file or directory: '/var/lib/wazo-auth-keys/wazo-upgrade-key.yml'
Traceback (most recent call last):
  File "/usr/share/xivo-upgrade/post-start.d/25_dird_tenant_migration.py", line 134, in <module>
    main()
  File "/usr/share/xivo-upgrade/post-start.d/25_dird_tenant_migration.py", line 116, in main
    migrate_tenants()
  File "/usr/share/xivo-upgrade/post-start.d/25_dird_tenant_migration.py", line 81, in migrate_tenants
    config = _load_config()
  File "/usr/share/xivo-upgrade/post-start.d/25_dird_tenant_migration.py", line 31, in _load_config
    key_config = _load_key_file(ChainMap(file_config, _DEFAULT_CONFIG))
  File "/usr/share/xivo-upgrade/post-start.d/25_dird_tenant_migration.py", line 38, in _load_key_file
    'auth': {'username': key_file['service_id'], 'password': key_file['service_key']},
KeyError: 'service_id'
Executing upgrade script /usr/share/xivo-upgrade/post-start.d/26-dird-auto-create-config.py...
Could not read config file /var/lib/wazo-auth-keys/wazo-upgrade-key.yml: [Errno 2] No such file or directory: '/var/lib/wazo-auth-keys/wazo-upgrade-key.yml'
Traceback (most recent call last):
  File "/usr/share/xivo-upgrade/post-start.d/26-dird-auto-create-config.py", line 251, in <module>
    main()
  File "/usr/share/xivo-upgrade/post-start.d/26-dird-auto-create-config.py", line 233, in main
    _auto_create_config()
  File "/usr/share/xivo-upgrade/post-start.d/26-dird-auto-create-config.py", line 124, in _auto_create_config
    config = _load_config()
  File "/usr/share/xivo-upgrade/post-start.d/26-dird-auto-create-config.py", line 109, in _load_config
    key_config = _load_key_file(ChainMap(file_config, _DEFAULT_CONFIG))
  File "/usr/share/xivo-upgrade/post-start.d/26-dird-auto-create-config.py", line 117, in _load_key_file
    'username': key_file['service_id'],
KeyError: 'service_id'
Executing upgrade script /usr/share/xivo-upgrade/post-start.d/30_provd_default_passwords...
Executing upgrade script /usr/share/xivo-upgrade/post-start.d/50-autoprov-generate-config.py...
Could not read config file /var/lib/wazo-auth-keys/wazo-upgrade-key.yml: [Errno 2] No such file or directory: '/var/lib/wazo-auth-keys/wazo-upgrade-key.yml'
Traceback (most recent call last):
  File "/usr/share/xivo-upgrade/post-start.d/50-autoprov-generate-config.py", line 46, in <module>
    config = load_config()
  File "/usr/share/xivo-upgrade/post-start.d/50-autoprov-generate-config.py", line 36, in load_config
    key_config = _load_key_file(ChainMap(file_config, _DEFAULT_CONFIG))
  File "/usr/share/xivo-upgrade/post-start.d/50-autoprov-generate-config.py", line 42, in _load_key_file
    return {'auth': {'username': key_file['service_id'],
KeyError: 'service_id'
Executing upgrade script /usr/share/xivo-upgrade/post-start.d/55_provd_device_tenant_migration.py...
Could not read config file /var/lib/wazo-auth-keys/wazo-upgrade-key.yml: [Errno 2] No such file or directory: '/var/lib/wazo-auth-keys/wazo-upgrade-key.yml'
Traceback (most recent call last):
  File "/usr/share/xivo-upgrade/post-start.d/55_provd_device_tenant_migration.py", line 141, in <module>
    main()
  File "/usr/share/xivo-upgrade/post-start.d/55_provd_device_tenant_migration.py", line 123, in main
    migrate_tenants()
  File "/usr/share/xivo-upgrade/post-start.d/55_provd_device_tenant_migration.py", line 70, in migrate_tenants
    config = _load_config()
  File "/usr/share/xivo-upgrade/post-start.d/55_provd_device_tenant_migration.py", line 35, in _load_config
    key_config = _load_key_file(ChainMap(file_config, _DEFAULT_CONFIG))
  File "/usr/share/xivo-upgrade/post-start.d/55_provd_device_tenant_migration.py", line 42, in _load_key_file
    'auth': {'username': key_file['service_id'], 'password': key_file['service_key']},
KeyError: 'service_id'
Executing upgrade script /usr/share/xivo-upgrade/post-start.d/56_provd_device_new_status_migration.py...
Could not read config file /var/lib/wazo-auth-keys/wazo-upgrade-key.yml: [Errno 2] No such file or directory: '/var/lib/wazo-auth-keys/wazo-upgrade-key.yml'
Traceback (most recent call last):
  File "/usr/share/xivo-upgrade/post-start.d/56_provd_device_new_status_migration.py", line 121, in <module>
    main()
  File "/usr/share/xivo-upgrade/post-start.d/56_provd_device_new_status_migration.py", line 103, in main
    migrate_new_status()
  File "/usr/share/xivo-upgrade/post-start.d/56_provd_device_new_status_migration.py", line 69, in migrate_new_status
    config = _load_config()
  File "/usr/share/xivo-upgrade/post-start.d/56_provd_device_new_status_migration.py", line 34, in _load_config
    key_config = _load_key_file(ChainMap(file_config, _DEFAULT_CONFIG))
  File "/usr/share/xivo-upgrade/post-start.d/56_provd_device_new_status_migration.py", line 41, in _load_key_file
    'auth': {'username': key_file['service_id'], 'password': key_file['service_key']},
KeyError: 'service_id'
Executing upgrade script /usr/share/xivo-upgrade/post-start.d/57-provd-reconfigure-all-devices.py...
Could not read config file /var/lib/wazo-auth-keys/wazo-upgrade-key.yml: [Errno 2] No such file or directory: '/var/lib/wazo-auth-keys/wazo-upgrade-key.yml'
Traceback (most recent call last):
  File "/usr/share/xivo-upgrade/post-start.d/57-provd-reconfigure-all-devices.py", line 102, in <module>
    main()
  File "/usr/share/xivo-upgrade/post-start.d/57-provd-reconfigure-all-devices.py", line 84, in main
    reconfigure_all_devices()
  File "/usr/share/xivo-upgrade/post-start.d/57-provd-reconfigure-all-devices.py", line 56, in reconfigure_all_devices
    config = _load_config()
  File "/usr/share/xivo-upgrade/post-start.d/57-provd-reconfigure-all-devices.py", line 30, in _load_config
    key_config = _load_key_file(ChainMap(file_config, _DEFAULT_CONFIG))
  File "/usr/share/xivo-upgrade/post-start.d/57-provd-reconfigure-all-devices.py", line 37, in _load_key_file
    'auth': {'username': key_file['service_id'], 'password': key_file['service_key']},
KeyError: 'service_id'
Executing upgrade script /usr/share/xivo-upgrade/post-start.d/60-provd-remove-null-values-config.py...
Could not read config file /var/lib/wazo-auth-keys/wazo-upgrade-key.yml: [Errno 2] No such file or directory: '/var/lib/wazo-auth-keys/wazo-upgrade-key.yml'
Traceback (most recent call last):
  File "/usr/share/xivo-upgrade/post-start.d/60-provd-remove-null-values-config.py", line 110, in <module>
    main()
  File "/usr/share/xivo-upgrade/post-start.d/60-provd-remove-null-values-config.py", line 92, in main
    remove_null_values()
  File "/usr/share/xivo-upgrade/post-start.d/60-provd-remove-null-values-config.py", line 65, in remove_null_values
    config = _load_config()
  File "/usr/share/xivo-upgrade/post-start.d/60-provd-remove-null-values-config.py", line 30, in _load_config
    key_config = _load_key_file(ChainMap(file_config, _DEFAULT_CONFIG))
  File "/usr/share/xivo-upgrade/post-start.d/60-provd-remove-null-values-config.py", line 37, in _load_key_file
    'auth': {'username': key_file['service_id'], 'password': key_file['service_key']},
KeyError: 'service_id'
Executing upgrade script /usr/share/xivo-upgrade/post-start.d/61_webhookd_tenant_migration.py...
Could not read config file /var/lib/wazo-auth-keys/wazo-upgrade-key.yml: [Errno 2] No such file or directory: '/var/lib/wazo-auth-keys/wazo-upgrade-key.yml'
Traceback (most recent call last):
  File "/usr/share/xivo-upgrade/post-start.d/61_webhookd_tenant_migration.py", line 139, in <module>
    main()
  File "/usr/share/xivo-upgrade/post-start.d/61_webhookd_tenant_migration.py", line 121, in main
    migrate_tenants()
  File "/usr/share/xivo-upgrade/post-start.d/61_webhookd_tenant_migration.py", line 80, in migrate_tenants
    config = _load_config()
  File "/usr/share/xivo-upgrade/post-start.d/61_webhookd_tenant_migration.py", line 31, in _load_config
    key_config = _load_key_file(ChainMap(file_config, _DEFAULT_CONFIG))
  File "/usr/share/xivo-upgrade/post-start.d/61_webhookd_tenant_migration.py", line 38, in _load_key_file
    'auth': {'username': key_file['service_id'], 'password': key_file['service_key']},
KeyError: 'service_id'
Executing upgrade script /usr/share/xivo-upgrade/post-start.d/62_call_logd_tenant_migration.py...
Could not read config file /var/lib/wazo-auth-keys/wazo-upgrade-key.yml: [Errno 2] No such file or directory: '/var/lib/wazo-auth-keys/wazo-upgrade-key.yml'
Traceback (most recent call last):
  File "/usr/share/xivo-upgrade/post-start.d/62_call_logd_tenant_migration.py", line 144, in <module>
    main()
  File "/usr/share/xivo-upgrade/post-start.d/62_call_logd_tenant_migration.py", line 126, in main
    migrate_tenants()
  File "/usr/share/xivo-upgrade/post-start.d/62_call_logd_tenant_migration.py", line 82, in migrate_tenants
    config = _load_config()
  File "/usr/share/xivo-upgrade/post-start.d/62_call_logd_tenant_migration.py", line 32, in _load_config
    key_config = _load_key_file(ChainMap(file_config, _DEFAULT_CONFIG))
  File "/usr/share/xivo-upgrade/post-start.d/62_call_logd_tenant_migration.py", line 39, in _load_key_file
    'auth': {'username': key_file['service_id'], 'password': key_file['service_key']},
KeyError: 'service_id'

After this, wazo is broken everything is a mess, if I try to relaunch the “wazo-upgrade” :

ERROR: You must configure Wazo by running the web wizard before using wazo-upgrade

root@pvoiall001:~# wazo-service status
Checking database...
        NOK (current revision is 01b4c79b3d47)
Checking services...
        running         dahdi
        failed          wazo-plugind
        running         wazo-webhookd
        running         xivo-sysconfd
        running         xivo-confgend
        running         wazo-confd
        running         wazo-auth
        stopped         wazo-call-logd
        running         xivo-dxtora
        running         wazo-provd
        failed          wazo-agid
        stopped         asterisk
        stopped         xivo-amid
        failed          wazo-agentd
        failed          wazo-dird
        failed          wazo-phoned
        failed          wazo-calld
        stopped         wazo-websocketd
        failed          wazo-chatd
root@pvoiall001:~# wazo-service restart
Closing port 5060.
Waiting for services to stop successfully...
Waiting for services to start successfully...
        starting dahdi ... OK
        starting wazo-plugind ... OK
        starting wazo-webhookd ... OK
        starting xivo-sysconfd ... OK
        starting xivo-confgend ... OK
        starting wazo-confd ... OK
        starting wazo-auth ... OK
        starting xivo-dxtora ... OK
        starting wazo-provd ... OK
        starting wazo-agid ...Job for wazo-agid.service failed because the control process exited with error code.
See "systemctl status wazo-agid.service" and "journalctl -xe" for details.
 NOK
Opening port 5060.

Is there any documentation for upgrading ?

Thanks