[RESOLVED] Update to Discovery: Error logging into the console

Share your tips or issues concerning the WAPT Console or WAPT Agent here
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
jlatieule
Messages: 59
Registration: July 3, 2019 - 9:18 AM

August 11, 2022 - 10:18

Hello,


I've made four attempts, each with the same result. Every time, I'm forced to restore the server to the previous snapshot.
I'm trying to update from the latest Community version to Discovery 2.2.

Everything seems to work correctly, but after the update, it's no longer possible to authenticate on the console with the "admin" account.
I've tried several combinations:
- Post-configuration: Password update or No update (to keep the old one)
- Console update: with complete uninstallation or everything automated by the Windows installer.

WAPT is installed on Debian 10.

How can I regain control of the console?

Sincerely
System and Network Administrator at Domitia Habitat
jlatieule
Messages: 59
Registration: July 3, 2019 - 9:18 AM

August 11, 2022 - 2:23 PM

I just tried importing the PostgreSQL database from the old server I'm trying to upgrade with a fresh installation.

Simply by loading the database with the same version of WAPT, it's no longer possible to connect to the new installation.

The problem likely lies there.
System and Network Administrator at Domitia Habitat
User avatar
sfonteneau
WAPT Expert
Messages: 2318
Registered: July 10, 2014 - 11:52 PM
Contact :

August 12, 2022 - 4:00 PM

Can you provide the version number of the database available on the web interface?

You can try a:

Code: Select all

sudo -u wapt /opt/wapt/waptpython.sh

Code: Select all

from waptserver.config import load_config
from waptserver.model import *
conf = waptserver.config.load_config('/opt/wapt/conf/waptserver.ini')
load_db_config(conf)
create_default_users(conf)
quit()
This allows you to recreate the admin account with the ACLs if it is not an admin account
jlatieule
Messages: 59
Registration: July 3, 2019 - 9:18 AM

August 12, 2022 - 4:36 PM

Hi Simon, glad to see you here after all these years in ICT ;-)

Here is the requested feedback:
Base status: OK (2.2.5.2)

And after running the Python code, I get this error message:

Code: Select all

administrateur@serv-wapt:~$ sudo -u wapt /opt/wapt/waptpython.sh
[sudo] password for administrateur: 
Python 3.8.13 (default, May 23 2022, 11:25:12) 
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from waptserver.config import load_config
>>> from waptserver.model import *
>>> conf = waptserver.config.load_config('/opt/wapt/conf/waptserver.ini')
>>> load_db_config(conf)
<playhouse.pool.PooledPostgresqlExtDatabase object at 0x7f7bb20678e0>
>>> create_default_users(conf)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/opt/wapt/waptserver/model.py", line 1246, in create_default_users
    if created or not admin_acls.acls.get('admin'):
AttributeError: 'NoneType' object has no attribute 'get'
>>> quit()
So I'm still having this authentication problem on the console ;-/
System and Network Administrator at Domitia Habitat
User avatar
sfonteneau
WAPT Expert
Messages: 2318
Registered: July 10, 2014 - 11:52 PM
Contact :

August 17, 2022 - 10:15

jlatieule wrote: August 12, 2022 - 4:36 PM Hi Simon, glad to see you here after all these years of ICT ;-)
Still here ;)

Okay, the database is stuck at 2.2.5.2

The problem therefore lies between the switch from 2.2.5.2 to 2.2.6.0

In the latest version of wapt, the base is 2.2.6.1


The code is ugly here because on line 3083 of model.py we have:

Code: Select all

    
    finally:
        pass
 
So we're unlikely to see the mistake...

You can replace the code in model.py on line 3083 with:

Code: Select all

    except:
        import traceback
        print(traceback.format_exc())

    finally:
        pass



then you can try a:

Code: Select all

sudo -u wapt /opt/wapt/waptpython.sh

Code: Select all

from waptserver.config import load_config
from waptserver.model import *
conf = waptserver.config.load_config('/opt/wapt/conf/waptserver.ini')
load_db_config(conf)
upgrade_db_structure(conf)
At least we'll see something

Also, what version of PostgreSQL do you have installed?
jlatieule
Messages: 59
Registration: July 3, 2019 - 9:18 AM

August 17, 2022 - 12:42

Indeed, we can see more information.

Regarding the PostgreSQL version:
postgres (PostgreSQL) 11.17 (Debian 11.17-0+deb10u1)
and the return of the upgrade:

Code: Select all

>>> from waptserver.config import load_config
>>> from waptserver.model import *
>>> conf = waptserver.config.load_config('/opt/wapt/conf/waptserver.ini')
>>> load_db_config(conf)
<playhouse.pool.PooledPostgresqlExtDatabase object at 0x7fc32e401940>
>>> upgrade_db_structure(conf)
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 is_valid_jsonb(jsonb) does not exist
LINE 1: ...set value = to_jsonb(value::text)::text where not is_valid_j...
                                                             ^
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 "/opt/wapt/waptserver/model.py", line 2987, in upgrade_db_structure
    wapt_db.execute_sql("""update hostauditdata set value = to_jsonb(value::text)::text where not is_valid_jsonb(value) and not is_valid_jsonb(replace(value,'''','"'));""")
  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 is_valid_jsonb(jsonb) does not exist
LINE 1: ...set value = to_jsonb(value::text)::text where not is_valid_j...
                                                             ^
HINT:  No function matches the given name and argument types. You might need to add explicit type casts.
System and Network Administrator at Domitia Habitat
User avatar
sfonteneau
WAPT Expert
Messages: 2318
Registered: July 10, 2014 - 11:52 PM
Contact :

August 17, 2022 - 3:36 PM

Okay, we've identified the problem.

I'll see about pushing a nightly build today.
jlatieule
Messages: 59
Registration: July 3, 2019 - 9:18 AM

August 17, 2022 - 3:44 PM

Cool, I managed to report a bug

. Do I need to restore version 1.8.2 and redo the update, or will it be a command I need to run?
System and Network Administrator at Domitia Habitat
User avatar
sfonteneau
WAPT Expert
Messages: 2318
Registered: July 10, 2014 - 11:52 PM
Contact :

August 18, 2022 - 6:01 PM

Normally, just an upgrade will suffice; the database will migrate correctly with the new code.

Could you try this one?

https://wapt.tranquil.it/wapt/nightly/w ... 5-3fd94bd1

Simon
jlatieule
Messages: 59
Registration: July 3, 2019 - 9:18 AM

August 22, 2022 - 5:16 PM

Thanks Simon,


I searched for the Debian repository address from https://wapt.tranquil.it/Debian/ but I'm completely out of touch on this subject.

How can I install the nightly build you suggested?
System and Network Administrator at Domitia Habitat
Locked