简体   繁体   中英

Puppet vcsrepo behind firewall?

Trying to use vcsrepo module from puppet to install a GIT repository for devstack. Using https://github.com/ ... But am behind a firewall. There is a proxy server available for http, https, and FTP access to the Internet.

Is there a way to include the proxy, when using this module? I didn't find anything in the vcsrepo that seems to work. Willing to tweak (hack) the module, if needed.

You could look in the module vcsrepo/lib/puppet/provider/vcsrepo/git.rb

near the bottom of the file at:

def git_with_identity(*args)

add the following just under the above line:

if @resource.value(:http_proxy)
    ENV['http_proxy'] = @resource.value(:http_proxy)
    ENV['https_proxy'] = @resource.value(:http_proxy)
end

Next edit vcsrepo/lib/puppet/type/vcsrepo.rb - before the last end add:

 newparam :http_proxy do
 desc "http proxy to use to communicate with the outside world"
end

Now in your puppet manifest you can add http_proxy var:

vcsrepo { '/var/www/blash':
            ensure => present,
            provider => git,
            http_proxy => 'http://prxy.local:8080',
            require => Class['git-core'],
            source => 'http://github.com/blah/blah.git';
    }

I was able to work around this without modifying the vcsrepo code. Instead I created a .gitconfig file in root's home directory, which specify the proxy info for https/http protocols.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM