Defined Type: git::systemconfig

Defined in:
modules/git/manifests/systemconfig.pp

Overview

git::systemconfig

Generate /etc/gitconfig based on a hash of gitconfig values. Should be the same as executing git config –system. It is useful for use cases like the Analytics hosts whithin the related VLAN, that needs a common shared http.proxy configuration to be applied for each user.

Parameters:

[*settings*]
  Hash of gitconfig section name, each should be in turn a hash
  of configuration name => value.
[*priority*]
  Configuration loading priority. Default: '10'.

Example usage:

git::systemconfig { 'setup_http_proxy':

settings => {
    # https://wikitech.wikimedia.org/wiki/HTTP_proxy
    'http'  => {
        'proxy' => "http://webproxy.${::site}.wmnet:8080"
    },
    'https' => {
        'proxy' => "http://webproxy.${::site}.wmnet:8080"
    },
 },

}

Parameters:

  • settings (Hash[String, Hash[String, String]])
  • priority (Integer[1,99]) (defaults to: 10)


29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'modules/git/manifests/systemconfig.pp', line 29

define git::systemconfig(
    Hash[String, Hash[String, String]] $settings,
    Integer[1,99] $priority = 10,
) {
  include ::git::globalconfig

  $safe_title = $title.regsubst('\W', '_', 'G')
  $file_path = '/etc/gitconfig.d/%.2d-%s.gitconfig'.sprintf($priority, $safe_title)

  file { $file_path:
    ensure  => present,
    owner   => 'root',
    group   => 'root',
    mode    => '0444',
    content => template( 'git/gitconfig.erb' ),
    notify  => Exec['update-gitconfig'],
  }
}