Bug 965949 - oo-analytics-import is broken by "uninitialized constant MongoClient" error
oo-analytics-import is broken by "uninitialized constant MongoClient" error
Status: CLOSED CURRENTRELEASE
Product: OpenShift Online
Classification: Red Hat
Component: Pod (Show other bugs)
2.x
Unspecified Unspecified
medium Severity medium
: ---
: ---
Assigned To: Rajat Chopra
libra bugs
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2013-05-22 03:09 EDT by Jianwei Hou
Modified: 2015-05-14 20:17 EDT (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2013-06-11 00:08:15 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Jianwei Hou 2013-05-22 03:09:53 EDT
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 12:40:39 EDT
You are probably just missing the "include Mongo" line.
Comment 2 Rajat Chopra 2013-05-23 13:08:35 EDT
Fixed with rev#a881c2b93c1c14b44c1018bdb5272028b746b90a
Comment 3 Jianwei Hou 2013-05-23 22:00:03 EDT
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.