Execution of file.managed module behind the proxy

1,015 views
Skip to first unread message

Łukasz Jastrzębski

unread,
Jul 3, 2013, 5:59:30 PM7/3/13
to salt-...@googlegroups.com
Hi,

I am wondering if there is a special setting for file.managed in order to work behind the proxy.

My test case:
I am using this state:
git://github.com/saltstack-formulas/redis.git

and it fails during:
----------
    State: - file
    Name:      /usr/local/redis-stable.tar.gz
    Function:  managed
        Result:    False
        Comment:   An exception occurred in this state: Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/salt/state.py", line 1238, in call
    *cdata['args'], **cdata['kwargs'])
  File "/usr/lib/python2.7/dist-packages/salt/states/file.py", line 854, in managed
    contents)
  File "/usr/lib/python2.7/dist-packages/salt/modules/file.py", line 1647, in manage_file
    sfn = __salt__['cp.cache_file'](source, env)
  File "/usr/lib/python2.7/dist-packages/salt/modules/cp.py", line 229, in cache_file
    result = __context__['cp.fileclient'].cache_file(path, env)
  File "/usr/lib/python2.7/dist-packages/salt/fileclient.py", line 115, in cache_file
    return self.get_url(path, '', True, env)
  File "/usr/lib/python2.7/dist-packages/salt/fileclient.py", line 346, in get_url
    raise MinionError('Error reading {0}: {1}'.format(url, ex.reason))
MinionError: Error reading http://download.redis.io/redis-stable.tar.gz: [Errno 110] Connection timed out

minion itself needs to use http proxy in order to download anything from internet.
http_proxy variables are in /etc/environment:
http_proxy="http://87.254.212.120:8080"
https_proxy="http://87.254.212.120:8080"
ftp_proxy="http://87.254.212.120:8080"
HTTP_PROXY="http://87.254.212.120:8080"
HTTPS_PROXY="http://87.254.212.120:8080"
FTP_PROXY="http://87.254.212.120:8080"

as well as in /etc/sudoers
Defaults env_keep += "http_proxy https_proxy ftp_proxy noproxy HTTP_PROXY HTTPS_PROXY FTP_PROXY NOPROXY"

By the way apt works great with proxy settings:
Acquire::http::Proxy "http://87.254.212.120:8080";

As always any help highly appreciate it.

Best regards
Lukasz Jastrzebski

Łukasz Jastrzębski

unread,
Jul 4, 2013, 2:13:06 AM7/4/13
to salt-...@googlegroups.com
Hi,

Salt minion behaves differently when started through service or started from command line (generally speaking upstart ignores /etc/environment)
http://serverfault.com/questions/128605/have-upstart-read-environment-from-etc-environment-for-a-service

Do you have any workaround? or I should file a bug report?

Thanks

David Boucha

unread,
Jul 5, 2013, 3:43:00 PM7/5/13
to salt users list
Hey Lukasz,

Yeah, could you open an issue on this? Please include as many details as you can. 

Thanks!



--
You received this message because you are subscribed to the Google Groups "Salt-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to salt-users+...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 



--
Dave Boucha  |  Sr. Engineer


5272 South College Drive, Suite 301 | Murray, UT 84123

office 801-305-3563
da...@saltstack.com | www.saltstack.com

Matthew Williams

unread,
Jul 5, 2013, 3:46:15 PM7/5/13
to salt-...@googlegroups.com
There's an open pull request that fixes this:
https://github.com/saltstack/salt/pull/5937

Łukasz Jastrzębski

unread,
Jul 9, 2013, 11:25:09 AM7/9/13
to salt-...@googlegroups.com
Hi,

I included all the details in pull request:
https://github.com/saltstack/salt/pull/5937

I can provide more details if you miss something
Reply all
Reply to author
Forward
0 new messages