Vanilla.rb import script error


(c) #1

good day, I’m attempting to import a vanilla 2.1 forum exported using porter and am running into this error. thanks in advance for any assistance.

[code]# RAILS_ENV=production ruby apps/discourse/htdocs/script/import_scripts/vanilla.rb /home/cee/exp.txt
fatal: ambiguous argument ‘HEAD’: unknown revision or path not in the working tree.
Use ‘–’ to separate paths from revisions, like this:
'git […] – […]'
loading existing groups…
loading existing users…
loading existing categories…
loading existing posts…
loading existing topics…
parsing file…
reading file…
parsing comments…
parsing discussions…
parsing media…
parsing permissions…
parsing roles…
parsing users…
parsing user_discussions…
parsing user_roles…

importing users…
62 / 8067 ( 0.8%) Skipping user id 103 because email is blank
8067 / 8067 (100.0%)
importing categories…
apps/discourse/htdocs/script/import_scripts/vanilla.rb:116:in import_categories': private methodselect’ called for nil:NilClass (NoMethodError)
from apps/discourse/htdocs/script/import_scripts/vanilla.rb:20:in execute' from /opt/discourse-test/apps/discourse/htdocs/script/import_scripts/base.rb:45:inperform’
from apps/discourse/htdocs/script/import_scripts/vanilla.rb:254:in `'
root@vps52426:/opt/discourse-test# vim apps/discourse/htdocs/script/import_scripts/vanilla.rb
root@vps52426:/opt/discourse-test# vim apps/discourse/htdocs/script/import_scripts/vanilla.rb[/code]


(c) #2

here’s what happened when I tried importing via the vanilla_mysql.rb script

[code]/opt/discourse-test# RAILS_ENV=production ruby apps/discourse/htdocs/script/import_scripts/vanilla_mysql.rb /home/cee/cw-exp.sql
fatal: ambiguous argument ‘HEAD’: unknown revision or path not in the working tree.
Use ‘–’ to separate paths from revisions, like this:
'git […] – […]'
loading existing groups…
loading existing users…
loading existing categories…
loading existing posts…
loading existing topics…

creating users
apps/discourse/htdocs/script/import_scripts/vanilla_mysql.rb:45:in block in import_users': undefined local variable or methodusers’ for #ImportScripts::VanillaSQL:0x000ca1200eaa10 (NameError)
from /opt/discourse-test/apps/discourse/htdocs/script/import_scripts/base.rb:670:in block in batches' from /opt/discourse-test/apps/discourse/htdocs/script/import_scripts/base.rb:669:inloop’
from /opt/discourse-test/apps/discourse/htdocs/script/import_scripts/base.rb:669:in batches' from apps/discourse/htdocs/script/import_scripts/vanilla_mysql.rb:34:inimport_users’
from apps/discourse/htdocs/script/import_scripts/vanilla_mysql.rb:23:in execute' from /opt/discourse-test/apps/discourse/htdocs/script/import_scripts/base.rb:45:inperform’
from apps/discourse/htdocs/script/import_scripts/vanilla_mysql.rb:232:in `’[/code]


(Neil Lalonde) #3

The vanilla_mysql.rb script doesn’t take any arguments. You need to load that sql file into a mysql db before running the script. Also, the constants at the top of the script need to be edited before its run.


(c) #4

I did actually edit the constants before running the script. seems like it ran even though I added the ‘/home/cee/exp.txt’ part on the end. I’ll try running the command again without any arguements.


(c) #5

I was able to run vanilla.rb by commenting out the import categories, private_topics and private_posts starting on line 19

there was also an error importing the private_topics, which is why I commented it out

[code] import_users

import_categories

 import_topics
 import_posts

import_private_topics

import_private_posts[/code]

I can live without the private topics and posts but it would be nice to have categories and the proper category id’s for each post. I guess I’ll have to migrate the category data manually. the view counts for each topic did not transfer over either.