Bug 828987

Summary: Cannot pass SSH_AUTH_SOCK into mock scm commands
Product: [Fedora] Fedora EPEL Reporter: Max Romanov <max.romanov>
Component: mockAssignee: Clark Williams <williams>
Status: CLOSED WONTFIX QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: el5CC: mebrown, myllynen, williams
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-06-08 07:56:32 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:
Attachments:
Description Flags
Configure environment from command line none

Description Max Romanov 2012-06-05 17:33:28 UTC
Created attachment 589593 [details]
Configure environment from command line

Description of problem:

Using mock + scm under RHEL5 with EPEL, it is impossible to pass environment variable SSH_AUTH_SOCK to scm command execution environment. Solution of bug 803217 is not working because usermode package in RHEL5 is too old to understand KEEP_ENV_VARS option.

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

mock-1.0.29-1.el5
usermode-1.88-3.el5.2

How reproducible:

Steps to Reproduce:
1. Configure SVN using SSH:
...
config_opts['scm_opts']['method'] = 'svn'
config_opts['scm_opts']['svn_get'] = "svn co svn+ssh://svn/svnroot/SCM_PKG"
...
2. Ensure SSH_AUTH_SOCK is set and connection to svn host can be established:
$ echo "$SSH_AUTH_SOCK"
/tmp/ssh-jlTbf12545/agent.12545
$ ssh svn pwd
/home/max
3. start mock
$ mock -v --scm-enable
DEBUG: Initializing SCM integration...
DEBUG: SCM checkout command: 
svn co svn+ssh://svn/svnroot/package

DEBUG: SCM checkout post command: None
DEBUG: SCM checkout directory: /tmp/tmpKX0Mm-.mock-scm.package
DEBUG: Executing command: ['svn co svn+ssh://svn/svnroot/package'] with env {'LANG': 'en_US.UTF-8', 'TERM': 'vt100', 'SHELL': '/bin/bash', 'CVS_RSH': 'ssh', 'PROMPT_COMMAND': 'echo -n "<mock-chroot>"', 'PATH': '/usr/bin:/bin:/usr/sbin:/sbin', 'HOME': '/home/max', 'HOSTNAME': 'mock', 'SSH_AUTH_SOCK': '/home/max/.ssh/auth_sock'}
DEBUG: svn: To better debug SSH connection problems, remove the -q option from 'ssh' in the [tunnels] section of your Subversion configuration file.
DEBUG: svn: Network connection closed unexpectedly
DEBUG: Child returncode was: 1
ERROR: Command failed. See logs for output.
 # ['svn co svn+ssh://svn/svnroot/package']

  
Actual results:

Command environment includes 'SSH_AUTH_SOCK': '/home/max/.ssh/auth_sock'

Expected results:

'SSH_AUTH_SOCK': '/tmp/ssh-jlTbf12545/agent.12545'

Additional info:

Attached patch to add an ability to configure environment variables using command-line switch --environment. The main use case is to pass SSH_AUTH_SOCK value when usermode package is too old to understand KEEP_ENV_VARS option: --environment SSH_AUTH_SOCK=$SSH_AUTH_SOCK

Comment 1 Marko Myllynen 2012-06-06 07:29:22 UTC
Perhaps you noticed already, you can workaround the usermode.el5 limitation by creating the ~/.ssh/auth_sock link (perhaps in a shell alias/function to "automate" it):

$ ln -sf $SSH_AUTH_SOCK ~/.ssh/auth_sock
$ mock -v --scm-enable
...

Although this requires one extra step I'm not sure the patch would make things notably easier. Also, allowing users to pass arbitrary environment variables might have implications.

Clark, what do you think?

Comment 2 Max Romanov 2012-06-06 09:54:01 UTC
Argee, the workaround with link have almost same complexity, as passing the value in command line.

Thank you, Marko!

Comment 3 Marko Myllynen 2012-06-08 07:56:32 UTC
Ok, glad to hear it works, closing.

Comment 4 Clark Williams 2012-06-09 15:10:56 UTC
Marko, sorry I missed this, but I agree completely