[RESOLVED] Migration issue from 2.2.3 to 2.5

Questions about WAPT Server / Requests and help related to the WAPT server
Forum Rules
Community Forum Rules
* English support on www.reddit.com/r/wapt
* French community support is available on this forum
* Please prefix the topic title with [RESOLVED] if it is resolved.
* Please do not edit a topic that is tagged [RESOLVED]. Open a new topic referencing the old one.
* Specify the installed WAPT version, full version, and build number (2.2.1.11957 / 2.2.2.12337 / etc.) as well as the Enterprise/Discovery edition.
* Versions 1.8.2 and earlier are no longer supported. The only questions accepted regarding version 1.8.2 are related to upgrading to a supported version (2.1, 2.2, etc.).
* Specify the server OS (Linux/Windows) and version (Debian Buster/Bullseye - CentOS 7 - Windows Server 2012/2016/2019).
* Specify the OS of the administration/package creation machine and the machine with the problematic agent, if applicable (Windows 7/10/11/Debian 11/etc.).
* Avoid asking multiple questions when opening a topic, otherwise it may be ignored. If there are multiple topics, open separate topics, preferably one after the other and not all at the same time (i.e., do not spam the forum).
* Include code snippets, screenshots, and other images directly in the post. Links to Pastebin, Bitly, and other third-party sites will be systematically removed.
* As with any community forum, support is provided voluntarily by members. If you require commercial support, you can contact Tranquil IT's sales department at 02.40.97.57.55
Locked
essaghir
Messages: 5
Registration: February 7, 2024 - 10:58

February 7, 2024 - 11:09

Good morning,

Distributor ID: Debian
Description: Debian GNU/Linux 10 (buster)
Release: 10
Codename: buster
Postgres 11.2

The migration failed, with the logs below:

Code: Select all

2024-02-07 10:52:53,126 INFO Migrating from 2.4.0.0 to 2.4.2.0
Traceback (most recent call last):
  File "/opt/wapt/lib/python3.8/site-packages/peewee.py", line 3144, in execute_sql
    cursor.execute(sql, params or ())
psycopg2.errors.UndefinedFunction: function string_to_array(character varying[], unknown) does not exist
LINE 1: ...kages ALTER COLUMN target_os TYPE varchar[] USING string_to_...
                                                             ^
HINT:  No function matches the given name and argument types. You might need to add explicit type casts.


During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/opt/wapt/waptserver/model.py", line 2677, in upgrade_db_structure
    wapt_db.execute_sql("ALTER TABLE packages ALTER COLUMN target_os TYPE varchar[] USING string_to_array(target_os,',');")
  File "/opt/wapt/lib/python3.8/site-packages/peewee.py", line 3151, in execute_sql
    self.commit()
  File "/opt/wapt/lib/python3.8/site-packages/peewee.py", line 2917, in __exit__
    reraise(new_type, new_type(exc_value, *exc_args), traceback)
  File "/opt/wapt/lib/python3.8/site-packages/peewee.py", line 190, in reraise
    raise value.with_traceback(tb)
  File "/opt/wapt/lib/python3.8/site-packages/peewee.py", line 3144, in execute_sql
    cursor.execute(sql, params or ())
peewee.ProgrammingError: function string_to_array(character varying[], unknown) does not exist
LINE 1: ...kages ALTER COLUMN target_os TYPE varchar[] USING string_to_...
                                                             ^
HINT:  No function matches the given name and argument types. You might need to add explicit type casts.
Can you please help me debug the problem?

Thank you in advance for your answers.
User avatar
dcardon
WAPT Expert
Messages: 1930
Registration: June 18, 2014 - 09:58
Location: Saint Sébastien sur Loire
Contact :

February 7, 2024 - 2:59 PM

Hello Mohamed,

Can you verify that it is indeed version 11 of PostgreSQL that is currently running on your server?
When upgrading a Debian system, the old version of Postgres is not automatically upgraded.

Code: Select all

sudo -u postgres psql template1
    SHOW server_version;

The command can be corrected with a CAST, but this shouldn't be necessary on a Postgres version >=10...

Sincerely,

Denis
Denis Cardon - Tranquil IT
Share your experiences on WAPT! Send us your blog and article URLs in the "Your Opinion of the forum, and we'll feature them on the WAPT
essaghir
Messages: 5
Registration: February 7, 2024 - 10:58

February 7, 2024 - 3:57 PM

Hello Denis,

Below is the result of the command:

Code: Select all

could not change directory to "/root": Permission denied
psql (11.22 (Debian 11.22-0+deb10u1))
Type "help" for help.

template1=# SHOW server_version;
         server_version
--------------------------------
 11.22 (Debian 11.22-0+deb10u1)
It appears to be version 11.

I am available if you require any further information.

Sincerely,
Mohamed
User avatar
dcardon
WAPT Expert
Messages: 1930
Registration: June 18, 2014 - 09:58
Location: Saint Sébastien sur Loire
Contact :

February 7, 2024 - 5:44 PM

Hi Mohamed,

we managed to reproduce the problem internally. The column is already in varchar[] when the string_array function is called... It's quite strange. The problem only occurs when upgrading from version 2.2.3 to 2.5, not from 2.3 to 2.5. We'll keep you posted.

Best regards,

Denis
Denis Cardon - Tranquil IT
Share your experiences on WAPT! Send us your blog and article URLs in the "Your Opinion of the forum, and we'll feature them on the WAPT
User avatar
dcardon
WAPT Expert
Messages: 1930
Registration: June 18, 2014 - 09:58
Location: Saint Sébastien sur Loire
Contact :

February 8, 2024 - 12:11

Hello Mohamed,

While waiting for a nightly build, you can comment out the following lines in the /opt/wapt/waptserver/model.py file (lines 2673 to 2680). This issue affects users upgrading from WAPT version 2.2.3 or earlier. It does not affect users upgrading from version 2.3 or 2.4

Code: Select all

#    next_version = '2.4.2.0'
#    if get_db_version() < next_version:
#        with wapt_db.atomic():
#            logger.info("Migrating from %s to %s" % (get_db_version(), next_version))
#            wapt_db.execute_sql("ALTER TABLE packages ALTER COLUMN target_os TYPE varchar[] USING string_to_array(target_os,',');")
#            wapt_db.execute_sql("ALTER TABLE packages ALTER COLUMN licence TYPE varchar[] USING string_to_array(licence,',');")
#            wapt_db.execute_sql("ALTER TABLE packages ALTER COLUMN locale TYPE varchar[] USING string_to_array(locale,',');")
#            wapt_db.execute_sql("ALTER TABLE packages ALTER COLUMN architecture TYPE varchar[] USING string_to_array(architecture,',');")
then restart the wapt server

Code: Select all

systemctl restart waptserver
Sincerely,

Denis
Denis Cardon - Tranquil IT
Share your experiences on WAPT! Send us your blog and article URLs in the "Your Opinion of the forum, and we'll feature them on the WAPT
essaghir
Messages: 5
Registration: February 7, 2024 - 10:58

February 9, 2024 - 11:03

Hello Denis,
Thank you for your help. With the modification, the console launches in version 2.5.3.15292.

However, when I run "Build and send waptupgrade", I get an error: "-0 is not a valid version string".

Do you have any idea why?

Sincerely,
User avatar
dcardon
WAPT Expert
Messages: 1930
Registration: June 18, 2014 - 09:58
Location: Saint Sébastien sur Loire
Contact :

February 9, 2024 - 12:02 PM

Hello Mohamed,

thank you for your feedback. The fix for upgrading from version 2.2.3 will be available in the next release, 2.5.4.

For other questions, please start a new thread (see forum rules: one topic per thread).

I'm marking this thread as RESOLVED.

Regards,

Denis
Denis Cardon - Tranquil IT
Share your experiences on WAPT! Send us your blog and article URLs in the "Your Opinion of the forum, and we'll feature them on the WAPT
Locked