Defined Type: rustup::exec
- Defined in:
- manifests/exec.pp
Summary
Run a `rustup` commandOverview
The name should start with the username followed by a colon and a space, then the command. For example:
“‘puppet rustup::exec { ’daniel: rustup default nightly’: } “‘
43 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 |
# File 'manifests/exec.pp', line 43
define rustup::exec (
String[1] $user = $name.split(': ')[0],
String[1] $command = $name.split(': ')[1],
Optional[String[1]] $creates = undef,
Array[String[1]] $environment = [],
Rustup::OptionalStringOrArray $onlyif = undef,
Boolean $refreshonly = false,
Rustup::OptionalStringOrArray $unless = undef,
Stdlib::Absolutepath $home = rustup::home($user),
Stdlib::Absolutepath $rustup_home = "${home}/.rustup",
Stdlib::Absolutepath $cargo_home = "${home}/.cargo",
Stdlib::Absolutepath $bin = "${cargo_home}/bin",
Hash[String[1], Any] $more = {},
) {
$params = {
command => $command,
creates => $creates,
environment => [
"RUSTUP_HOME=${rustup_home}",
"CARGO_HOME=${cargo_home}",
] + $environment,
onlyif => $onlyif,
path => "${bin}:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
refreshonly => $refreshonly,
'unless' => $unless,
user => $user,
}
File <| name == $rustup_home or name == $cargo_home |>
-> exec { "rustup::exec: ${name}":
* => $params + $more,
}
# Generally exec requires an installation...
Rustup_internal <| |> -> Exec["rustup::exec: ${name}"]
# ...except when the installation is being deleted. In that case, the exec
# probably doesn’t need to run. Making the exec dependent on `rustup` being
# installed can help:
#
# onlyif => "sh -c 'command -v rustup &>/dev/null' && ...",
}
|