Bug 965949 - oo-analytics-import is broken by "uninitialized constant MongoClient" error
Summary: oo-analytics-import is broken by "uninitialized constant MongoClient" error
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: OpenShift Online
Classification: Red Hat
Component: Pod
Version: 2.x
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: ---
: ---
Assignee: Rajat Chopra
QA Contact: libra bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2013-05-22 07:09 UTC by Jianwei Hou
Modified: 2015-05-15 00:17 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2013-06-11 04:08:15 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Jianwei Hou 2013-05-22 07:09:53 UTC
Description of problem:
Import analytic data with oo-analytics-import, the script was broken with "uninitialized constant MongoClient (NameError)".
This can be work around by adding following two lines in the script.
require 'mongo'
include Mongo 

Version-Release number of selected component (if applicable):
On devenv_3257

How reproducible:
Always

Steps to Reproduce:
1. Export analytic data with oo-analytics-export
oo-analytics-export --outfile exp.tar.gz
2. Connect to analytics db, add user, then import analytic data with oo-analytics-import

mongo analytics
db.addUser('openshift','mooo',{readOnly:false})

oo-analytics-import --infile exp.tar.gz


Actual results:
After step 2:
Post processing..
/usr/sbin/oo-analytics-import:53:in `analytics_db': uninitialized constant MongoClient (NameError)
	from /usr/sbin/oo-analytics-import:70:in `<main>'

Expected results:
Should be able to import successfully

Additional info:

Comment 1 Abhishek Gupta 2013-05-22 16:40:39 UTC
You are probably just missing the "include Mongo" line.

Comment 2 Rajat Chopra 2013-05-23 17:08:35 UTC
Fixed with rev#a881c2b93c1c14b44c1018bdb5272028b746b90a

Comment 3 Jianwei Hou 2013-05-24 02:00:03 UTC
This is verified on devenv_3267

Analytic data can be imported successfully

[root@ip-10-147-160-150 ~]# oo-analytics-import --infile exp.tar.gz
Extracting analytics from 'exp.tar.gz'

Running mongoimport on file [analytics.apps.json] on collection [applications]
connected to: localhost:27017
Thu May 23 21:58:32 imported 1 objects

Running mongoimport on file [analytics.domains.json] on collection [domains]
connected to: localhost:27017
Thu May 23 21:58:32 imported 2 objects

Running mongoimport on file [analytics.usage.json] on collection [usage]
connected to: localhost:27017
Thu May 23 21:58:32 imported 1 objects

Running mongoimport on file [analytics.users.json] on collection [cloud_users]
connected to: localhost:27017
Thu May 23 21:58:32 imported 6 objects

Post processing..
Import complete!


Note You need to log in before you can comment on or make changes to this bug.