Page 1 of 1

[RESOLVED] Version 1.3.13 to 1.6

Published: September 25, 2018 - 4:38 PM
by James
Hello,
I just tested the upgrade from version 1.3.13 to 1.6 and it's crashing during the migration of the MongoDB database to PostgreSQL. As a result, when I install the WAPT console, I no longer have my old machines... :(

https://framapic.org/gallery#D3y4xUzl1O ... s7pa74.PNG

Regards

Re: Transition from 1.3.13 to 1.6

Published: September 25, 2018 - 5:12 PM
by sfonteneau
Oops, can you run:

Code: Select all

sudo -u wapt PYTHONPATH=/opt/wapt PYTHONHOME=/opt/wapt /opt/wapt/bin/python /opt/wapt/waptserver/upgrade.py upgrade2postgres -c "/opt/wapt/conf/waptserver.ini"'

Re: Transition from 1.3.13 to 1.6

Published: September 25, 2018 - 6:34 PM
by James
It works much better this way. :D
Will you make the change in a future version?

Re: Transition from 1.3.13 to 1.6

Published: September 25, 2018 - 6:48 PM
by sfonteneau
Exactly

Re: [SOLVED] Upgrading from 1.3.13 to 1.6

Published: October 25, 2018 - 12:37
by iutlps-informatique
Good morning

I also had a problem during the database migration with the postconf.sh script.

So I tried the command you indicated, namely:

Code: Select all

sudo -u wapt PYTHONPATH=/opt/wapt PYTHONHOME=/opt/wapt /opt/wapt/bin/python /opt/wapt/waptserver/upgrade.py upgrade2postgres -c "/opt/wapt/conf/waptserver.ini"
This does not work (see below).

Code: Select all

dumping mongodb data
If you are running a mongod on the same path you should connect to that instead of direct data file access
2018-10-25T12:28:43.130+0200 [tools] dbexit:
2018-10-25T12:28:43.130+0200 [tools] shutdown: going to close listening sockets...
2018-10-25T12:28:43.130+0200 [tools] shutdown: going to flush diaglog...
2018-10-25T12:28:43.130+0200 [tools] shutdown: going to close sockets...
2018-10-25T12:28:43.131+0200 [tools] shutdown: waiting for fs preallocator...
2018-10-25T12:28:43.131+0200 [tools] shutdown: closing all files...
2018-10-25T12:28:43.131+0200 [tools] closeAllFiles() finished
2018-10-25T12:28:43.131+0200 [tools] shutdown: removing fs lock...
2018-10-25T12:28:43.131+0200 [tools] couldn't remove fs lock errno:9 Bad file descriptor
2018-10-25T12:28:43.131+0200 [tools] dbexit: really exiting now
Traceback (most recent call last):
  File "/opt/wapt/waptserver/upgrade.py", line 190, in <module>
    upgrade2postgres()
  File "/opt/wapt/waptserver/upgrade.py", line 152, in upgrade2postgres
    jsondata = create_import_data()
  File "/opt/wapt/waptserver/upgrade.py", line 71, in create_import_data
    data = subprocess.check_output('mongoexport -d wapt -c hosts --jsonArray --dbpath=%s' % mongo_datadir,shell=True)
  File "/usr/lib/python2.7/subprocess.py", line 574, in check_output
    raise CalledProcessError(retcode, cmd, output=output)
subprocess.CalledProcessError: Command 'mongoexport -d wapt -c hosts --jsonArray --dbpath=/var/lib/mongodb/' returned non-zero exit status 45
I have the impression that a mongod.lock file is created each time and causes a problem, or perhaps I'm mistaken?

Code: Select all

drwxr-xr-x  3 mongodb mongodb      4096 oct.  25 12:17 ./
drwxr-xr-x 42 root    root         4096 oct.  24 15:27 ../
drwxr-xr-x  2 mongodb mongodb      4096 oct.  25 12:17 journal/
-rw-------  1 mongodb mongodb  67108864 oct.  25 12:17 local.0
-rw-------  1 mongodb mongodb  16777216 oct.  25 12:17 local.ns
-rwxr-xr-x  1 mongodb mongodb         6 oct.  25 12:17 mongod.lock*
-rw-------  1 mongodb mongodb  67108864 oct.  24 13:49 wapt.0
-rw-------  1 mongodb mongodb 134217728 oct.  24 13:46 wapt.1
-rw-------  1 mongodb mongodb 268435456 oct.  24 13:34 wapt.2
-rw-------  1 mongodb mongodb  16777216 oct.  24 13:34 wapt.ns

Re: [SOLVED] Upgrading from 1.3.13 to 1.6

Published: October 25, 2018 - 2:19 PM
by iutlps-informatique
I found it, I had to delete this line in the /opt/wapt/waptserver/upgrade.py file!

Code: Select all

 data = subprocess.check_output('mongoexport -d wapt -c hosts --jsonArray --dbpath=%s' % mongo_datadir,shell=True)
        else:

Re: [SOLVED] Upgrading from 1.3.13 to 1.6

Published: October 25, 2018 - 6:08 PM
by dcardon
iutlps-informatique wrote: Oct 25, 2018 - 2:19 PM I found it, I had to delete this line in the /opt/wapt/waptserver/upgrade.py file!

Code: Select all

 data = subprocess.check_output('mongoexport -d wapt -c hosts --jsonArray --dbpath=%s' % mongo_datadir,shell=True)
        else:
This line retrieves data from the MongoDB database and integrates it into PostgreSQL. Removing it bypasses the retrieval of the existing inventory. That said, in version 1.3, all information contained in MongoDB is retrieved by the workstations. So, if you wait a little while, the database will be completely rebuilt.

I think your problem was related to the fact that MongoDB was still running. The shutdown would probably have been enough to resolve the issue.

Sincerely,

Denis

PS: It's best to avoid necroposting this thread; feel free to start a new topic!