Defined Type: tp::install::source
- Defined in:
- manifests/install/source.pp
Overview
This define installs the application (app) set in the given title git cloning the relevant source and eventually building or installing elements from it. The define takes care of:
-
Cloning the app git repo from the Internet (git_source setting is used)
-
Eventually building sources
-
Eventually installing the app’s binary to destination path
-
Eventually create and manage the relevant service
This define is declared from the tp::install define when $install_method is set to ‘source’ either via a params entry or directly in tinydata settings.
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 |
# File 'manifests/install/source.pp', line 44
define tp::install::source (
Variant[Boolean,String] $ensure = present,
Tp::Fail $on_missing_data = pick(getvar('tp::on_missing_data'),'notify'),
Hash $tp_params = pick($tp::tp_params, {}),
Hash $settings = {},
Boolean $auto_prereq = pick($tp::auto_prereq, false),
Optional[String] $version = undef,
Optional[String] $source = undef,
String[1] $owner = pick(getvar('identity.user'),'root'),
String[1] $group = pick(getvar('identity.group'),'root'),
) {
$app = $title
$sane_app = regsubst($app, '/', '_', 'G')
$destination = getvar('settings.destination')
$tp_dir = $tp::real_tp_params['conf']['path']
$real_source = $ensure ? {
'absent' => false,
default => pick($source,getvar('settings.urls.source'),getvar('settings.git_source'), false),
}
# Automatic dependencies management, if data defined
if $auto_prereq and getvar('settings.build.prerequisites') and $ensure != 'absent' {
tp::create_everything ( getvar('settings.build.prerequisites'), {})
}
if $real_source {
tp::source { $app:
ensure => $ensure,
source => $real_source,
path => $destination,
vcsrepo_options => delete_undef_values({
revision => $version,
}),
}
} else {
tp::fail($on_missing_data, "tp::install::source ${app} - Missing parameter source or tinydata: settings.git_url") # lint:ignore:140chars
}
}
|