Bug 1021671

Summary: pre_start_nodejs-0.10 action_hook does not fire on app restart
Product: OpenShift Online Reporter: Corey Daley <cdaley>
Component: ContainersAssignee: Jhon Honce <jhonce>
Status: CLOSED NOTABUG QA Contact: libra bugs <libra-bugs>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 2.x   
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-10-21 19:05:43 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Corey Daley 2013-10-21 18:48:34 UTC
Description of problem:
When using the pre_start_nodejs-0.10 action_hook to set an environment variable (such as NODE_ENV), on a nodejs cartridge, the environment variable is correctly set when creating the application, when doing a git push, or when doing an rhc app stop/rhc app start, but, when you do an rhc app restart, the script is not fired and the environment variable does not fire.  I'm not sure this is the intended result, as it makes no sense for that environment variable to disappear when you restart your application.  This also occurs if you restart your application from the web console.  I know that you can use the --env NODE_ENV=production when you create a gear from the command line, but this doesn't help when you use a web based quickstart.

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


How reproducible:


Steps to Reproduce:
1.  Create nodejs application and create a pre_start_nodejs-0.10 action_hook that sets an environment variable
2.  modify the code to show the environment variable on the screen when you go to the site you created
3.  deploy the application
4.  rhc app restart $appname, or restart from the web console

Actual results:
the environment variable will not be set after a restart

Expected results:
the environment variable should still exist (get re-set) when the app restarts, it should execute the pre_start_nodejs-0.10 action_hook since it is restarting the node server.

Additional info:

Comment 1 Jhon Honce 2013-10-21 19:05:43 UTC
Restart is a different code path in some cartridges than stop/start.  If you need pre_start called you can add a call to pre_start in pre_restart.