Defined Type: tp::source

Defined in:
manifests/source.pp

Overview

Makes a git clone of the repository of the given app or of what’s has been specified in the $source paramater

Parameters:

  • ensure (Variant[Boolean,String]) (defaults to: present)

    If to clone the repository or remove it

  • path (Variant[Undef,String]) (defaults to: undef)

    Path where to clone the repository

  • source (Variant[Undef,String]) (defaults to: undef)

    URL of the git repository to clone, if not set tinydata, if present is going to be used: v4 setting: urls.source. v3 setting: git_source

  • app (Variant[Undef,String]) (defaults to: $title)

    Name of the app to clone the repository of

  • my_settings (Hash) (defaults to: {})

    Custom settings to merge with the settings from tinydata

  • vcsrepo_options (Hash) (defaults to: {})

    Options to pass to the vcsrepo resource used when cloning the source

  • data_module (String[1]) (defaults to: 'tinydata')

    The name of the tinydata module to use

  • destination_dir (String[1]) (defaults to: '/opt/src')

    The directory where to clone the repository if no path is specified the default is /opt/src



25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'manifests/source.pp', line 25

define tp::source (

  Variant[Boolean,String] $ensure              = present,
  Variant[Undef,String]   $path                = undef,
  Variant[Undef,String]   $source              = undef,
  Variant[Undef,String]   $app                 = $title,

  Hash                    $my_settings         = {},
  Hash                    $vcsrepo_options     = {},
  String[1]               $data_module         = 'tinydata',
  String[1]               $destination_dir     = '/opt/src',

) {
  # Settings evaluation
  $tp_settings=tp_lookup($title,'settings',$data_module,'deep_merge')
  $settings = $tp_settings + $my_settings

  $real_source = pick_default($source,getvar('settings.urls.source'),getvar('settings.git_source'))

  if $real_source {
    tp::dir { "${app} source":
      ensure          => $ensure,
      path            => pick($path, $settings[git_destination], "${destination_dir}/${app}"),
      source          => $real_source,
      vcsrepo         => 'git',
      vcsrepo_options => $vcsrepo_options,
    }
  }
}