Created attachment 891318 [details] user_var_file_bug_connexion Description of problem: I have post in my user_vars some fileto put some envirronement variable. the directory is : /var/lib/openshift/XXXXX/.env/user_vars the file content some special character and are not printable. I attach and example of the file. then i quit my ssh session. Now I want to log in again and I got and error. I can't log in via ssh ( putty / winscp) and I can't commit to git via eclipse. I can do nothing. Here is the last log report: ssh://XXXXX.com/~/git/jbossews.git/: Traceback (most recent call last): File "/usr/bin/oo-trap-user", line 171, in <module> gear_env() File "/usr/bin/oo-trap-user", line 63, in gear_env load_env('~/.env') File "/usr/bin/oo-trap-user", line 49, in load_env load_env(os.path.join(directory, entry)) File "/usr/bin/oo-trap-user", line 56, in load_env os.environ[env] = file.read().rstrip() File "/usr/lib64/python2.6/os.py", line 471, in __setitem__ putenv(key, item) TypeError: putenv() argument 2 must be string without null bytes, not str Version-Release number of selected component (if applicable): How reproducible: put in .env/user_vars some file with special caracter not printable ( TEST attach ) exit session You are now enable to re-connect Steps to Reproduce: 1.put in .env/user_vars some file with special caracter not printable ( TEST attach ) 2.exit session 3.You are now enable to re-connect Actual results: Enable to connect to gear via ssh( putty / winscp / eclipse) Expected results: Is there a walk around to delete the file user_vars ? I want to be able to connect to my gear via ssh. Additional info:
I try to override the wrong file in user_vars using the command rhc scp upload but I had an error message : "Remote file, file_path, or directory could not be found." C:\temp\open>rhc scp -a app -t upload -l ./TEST -r .env/uservars/ Remote file, file_path, or directory could not be found. I dont know if I am badly using the command or if the scp ( ssh) command is not working.
using user_vars give the same result. C:\temp\open>rhc scp -a jbossews -t upload -l ./TEST -r .env/user_vars/ Remote file, file_path, or directory could not be found.
Reassigning to OpenShift Online product corresponding to rhcloud.com in comments.
FWIW Jhon I set component to node because it sounds like the user succeeded in setting an env var that completely breaks the ability to interact with the gear via ssh. So not really a CLI issue.
Looks like oo-trap-user needs to handle exceptions around this line: load_env('~/.env/user_vars')
Not a rhc issue, user can't ssh/scp/git to the gear.
We'll work on preventing a bad file in the user_vars dir from breaking ssh login. If you can provide the broken username and app name in a private comment, we can work to fix your specific gear to let you log in.
There were some permission errors on the files under user_vars, which we were able to resolve. Please verify you can log in now.
The problem when I looked into this was different. It was actually a permissions issue on the user env variables, which I fixed manually. By the way, handling exceptions around load_env could be bad. It would be better to handle them around this: with open(entry, 'r') as file: os.environ[env] = file.read().rstrip() Otherwise, critical env vars could be skipped depending on how early the broken file is evaluated.
Either permission errors or file format errors can trigger this exception
(In reply to Jordan Liggitt from comment #9) > There were some permission errors on the files under user_vars, which we > were able to resolve. Please verify you can log in now. Thanks you all. I succeed log in to my gear. the file under user_vars have been replaced by good file. [jbossews-xxxx.rhcloud.com yyyyyyyyyyyyyyyyyyyyyyy]\> ls -al .env/user_vars/ total 24 drwxrwx---. 2 root yyyyyyyyyyyyyyyyyyyyyyy 4096 Apr 29 15:45 . drwxr-x---. 3 root yyyyyyyyyyyyyyyyyyyyyyy 4096 Apr 9 04:02 .. -rw-r-----. 1 root yyyyyyyyyyyyyyyyyyyyyyy 4 May 1 15:18 XXXXCONNEXION -rw-r-----. 1 root yyyyyyyyyyyyyyyyyyyyyyy 4 May 1 15:19 YYYYCONNEXION -rw-------. 1 yyyyyyyyyyyyyyyyyyyyyyy yyyyyyyyyyyyyyyyyyyyyyy 1 Apr 29 15:20 TMOUT -rw-r-----. 1 root yyyyyyyyyyyyyyyyyyyyyyy 4 May 1 15:18 ZZZZCONNEXION
Fixed in https://github.com/openshift/origin-server/pull/5380
Veirified on devenv_4762. git push, ssh works well after the file wich special strings under .env/user_vars. 1. Create an app 2. Copy a file which contains special strings to .env/user_vars [wzheng@dhcp-65-16 apps]$ rhc scp app1 upload TEST .env/user_vars/ uploading TEST: 100% complete. 14/14 bytes transferred in 4.500863736 seconds 3. SSH to the app to check [app1-d.dev.rhcloud.com 5368c4b580062c43f8000008]\> ls .env/user_vars/ TEST 4. Make some changes in local repo and git push, no error appeas: [master fd4bdd5] p 0 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 123 Counting objects: 3, done. Delta compression using up to 8 threads. Compressing objects: 100% (2/2), done. Writing objects: 100% (2/2), 285 bytes, done. Total 2 (delta 0), reused 0 (delta 0) remote: Stopping PHP 5.3 cartridge (Apache+mod_php) remote: Waiting for stop to finish remote: Waiting for stop to finish remote: Building git ref 'master', commit fd4bdd5 remote: Checking .openshift/pear.txt for PEAR dependency... remote: Preparing build for deployment remote: Deployment id is f53226ad remote: Activating deployment remote: Starting PHP 5.3 cartridge (Apache+mod_php) remote: Application directory "/" selected as DocumentRoot remote: ------------------------- remote: Git Post-Receive Result: success remote: Activation status: success remote: Deployment completed with status: success To ssh://5368c4b580062c43f8000008.rhcloud.com/~/git/app1.git/ 3a3e3e4..fd4bdd5 master -> master