Bug 1216220 - oo-snapshot is not working
Summary: oo-snapshot is not working
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: OpenShift Container Platform
Classification: Red Hat
Component: Containers
Version: 2.2.0
Hardware: Unspecified
OS: Unspecified
high
unspecified
Target Milestone: ---
: ---
Assignee: Timothy Williams
QA Contact: libra bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2015-04-28 19:34 UTC by Ricardo Martinelli de Oliveira
Modified: 2015-07-21 19:12 UTC (History)
9 users (show)

Fixed In Version: rubygem-openshift-origin-node-1.36.1.1-1
Doc Type: Bug Fix
Doc Text:
The oo-snapshot command, which is a wrapper for '/usr/bin/gear snapshot', reports an unhelpful error when used outside of a gear environment. This bug fix updates /usr/bin/gear to report an error stating it should only be run inside of a gear when necessary environment variables are not defined. As a result, oo-snapshot reports the same error when run outside of a gear.
Clone Of:
Environment:
Last Closed: 2015-07-21 19:12:24 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2015:1463 0 normal SHIPPED_LIVE Red Hat OpenShift Enterprise 2.2.6 bug fix and enhancement update 2015-07-21 23:11:33 UTC

Description Ricardo Martinelli de Oliveira 2015-04-28 19:34:16 UTC
Description of problem:
After run oo-snapshot I get this error:

# oo-snapshot
invalid command. Use --help for more information
/opt/rh/ruby193/root/usr/share/gems/gems/openshift-origin-node-1.34.1.1/lib/openshift-origin-node/model/application_container.rb:112:in `getpwnam': can't convert nil into String (TypeError)
	from /opt/rh/ruby193/root/usr/share/gems/gems/openshift-origin-node-1.34.1.1/lib/openshift-origin-node/model/application_container.rb:112:in `block in initialize'
	from /opt/rh/ruby193/root/usr/share/gems/gems/openshift-origin-node-1.34.1.1/lib/openshift-origin-node/model/application_container.rb:110:in `each'
	from /opt/rh/ruby193/root/usr/share/gems/gems/openshift-origin-node-1.34.1.1/lib/openshift-origin-node/model/application_container.rb:110:in `initialize'
	from /usr/bin/gear:61:in `new'
	from /usr/bin/gear:61:in `<main>'


Version-Release number of selected component (if applicable):
OpenShift Enterprise 2.2

How reproducible:
Always you run oo-snapshot

Steps to Reproduce:
1. ssh to a Node host
2. run oo-snapshot

Actual results:
The command returns an error

Expected results:
The command should print the possible options to use with it.


Additional info:

Comment 2 Brenton Leanhardt 2015-04-28 20:27:55 UTC
Looks like it's a problem with /usr/bin/gear.

Comment 3 Timothy Williams 2015-04-30 13:52:11 UTC
oo-snapshot works when run inside a gear. The reason it fails outside of a gear is that the environment variables that '/usr/bin/gear' uses are not set:

@container = OpenShift::Runtime::ApplicationContainer.new(ENV['OPENSHIFT_APP_UUID'], ENV['OPENSHIFT_GEAR_UUID'], Etc.getpwuid.uid, ENV['OPENSHIFT_APP_NAME'], ENV['OPENSHIFT_GEAR_NAME'], ENV['OPENSHIFT_NAMESPACE'])

The error seen occurs any time /usr/bin/gear is run outside of a gear:

# gear
invalid command. Use --help for more information
/opt/rh/ruby193/root/usr/share/gems/gems/openshift-origin-node-1.35.4.2/lib/openshift-origin-node/model/application_container.rb:113:in `getpwnam': can't convert nil into String (TypeError)

I think the bigger problem here is that we don't document the use of oo-snapshot, which is just a wrapper for '/usr/bin/gear snapshot'.

I could see adding some logic in /usr/bin/gear to give a better error when it is run outside of a gear though. If we want to take this path:

https://github.com/openshift/origin-server/pull/6133

Comment 4 openshift-github-bot 2015-04-30 21:20:18 UTC
Commit pushed to master at https://github.com/openshift/origin-server

https://github.com/openshift/origin-server/commit/5054607c088762892498cbce7f7dd1f73dc950df
BZ1216220 - oo-snapshot fails when run outside of a gear

Bug 1216220
Bugzilla link https://bugzilla.redhat.com/show_bug.cgi?id=1216220
oo-snapshot and gear fail when run outside of a gear. Instead, these will fail gracefully with an error stating that they should not be run outside of a gear.

Comment 7 Anping Li 2015-05-05 03:00:08 UTC
There isn't package rubygem-openshift-origin-node-1.36.1.1-1 in puddle-2-2-2015-05-04 . We need to rebuild a puddle. thanks

Comment 11 Anping Li 2015-05-06 06:21:45 UTC
oo-snapshot provide clear message on node now.  I will run extend testing (app snapshot save/restore ) once 1218872 is fixed.

[root@node1 ~]# oo-snapshot 
This command should only be run inside of a gear.
The environment variables 'OPENSHIFT_APP_UUID' and 'OPENSHIFT_GEAR_UUID' are not set.
invalid command. Use --help for more information

Comment 12 Anping Li 2015-05-07 02:36:36 UTC
On puddle-2-2-2015-05-06. snapshot save/restore works. so move bug to verified.

[anli@broker ~]$ rhc snapshot save sphp
Pulling down a snapshot of application 'sphp' to sphp.tar.gz ... done
[anli@broker ~]$ rhc snapshot restore sphp
Restoring from snapshot sphp.tar.gz to application 'sphp' ... done

Comment 14 errata-xmlrpc 2015-07-21 19:12:24 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://rhn.redhat.com/errata/RHBA-2015-1463.html


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