Skip to content

Commit

Permalink
Merge 19699f7 into a4bccf8
Browse files Browse the repository at this point in the history
  • Loading branch information
bdandoy committed Sep 18, 2017
2 parents a4bccf8 + 19699f7 commit 17a7c6c
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 18 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@
- Ensure group creation. #188 (Enhancement)
Contributed by @bdandoy

- Fixes issue #175 Pack install command has been updated to new install command.
Added new version option to install specific versions of pack. #190 (Enhancement)
Contributed by @bdandoy

- Added more puppet-lint checks. #181
Contributed by @bdandoy

Expand Down
39 changes: 21 additions & 18 deletions manifests/pack.pp
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,16 @@
# Installs StackStorm Packs to the system
#
# === Parameters
# [*pack*] - Name of the pack to install
# [*repo_url*] - URL to install pack from (Default: github/StackStorm/st2contrib)
# [*pack*] - Name of the pack to install. This should be the name
# of the pack in the pack's YAML along with the directory
# created in /opt/stackstorm/packs/${pack}/ and name of config in
# /opt/stackstorm/configs/${pack}.yaml
# [*repo_url*] - URL of the pack to install when not installing from the exchange.
# If undef then install the pack from the exchange
# (default = undef)
# [*version*] - Version of pack to install can be tag, commit, or branch
# [*config*] - Hash that will be translated into YAML in the pack's config
# file after installation.
#
# === Examples
#
Expand All @@ -17,11 +25,9 @@
# st2::pack { 'linux, cicd': }
#
define st2::pack (
$ensure = present,
$pack = $name,
$repo_url = undef,
$register = undef,
$subtree = undef,
$version = 'latest',
$config = undef,
) {
include ::st2
Expand All @@ -30,17 +36,14 @@
$_auth = $::st2::auth
$_st2_packs_group = $::st2::params::packs_group_name

$_repo_url = $repo_url ? {
undef => '',
default => "repo_url=${repo_url}",
$_pack_or_url = $repo_url ? {
undef => $pack,
default => $repo_url,
}
$_register = $register ? {
undef => '',
default => "register=${register}",
}
$_subtree = $subtree ? {
undef => '',
default => "subtree=${subtree}",

$_pack_version = $version ? {
'latest' => undef,
default => $version,
}

ensure_resource('group', $_st2_packs_group, {
Expand Down Expand Up @@ -71,7 +74,7 @@
})

exec { "install-st2-pack-${pack}":
command => "st2 run packs.install packs=${pack} ${_repo_url} ${_register} ${_subtree}",
command => "st2 pack install ${_pack_or_url}${_pack_version}",
creates => "/opt/stackstorm/packs/${pack}",
path => '/usr/sbin:/usr/bin:/sbin:/bin',
tries => '5',
Expand All @@ -98,6 +101,6 @@
Group[$_st2_packs_group] -> File['/opt/stackstorm']
File['/opt/stackstorm'] -> File<| tag == 'st2::subdirs' |>
Package<| tag == 'st2::server::packages' |> -> File['/opt/stackstorm/packs']
Service<| tag == 'st2::service' |> -> Exec["install-st2-pack-${name}"]
Exec<| tag == 'st2::reload' |> ~> Exec["install-st2-pack-${name}"]
Service<| tag == 'st2::service' |> -> Exec["install-st2-pack-${pack}"]
Exec<| tag == 'st2::reload' |> ~> Exec["install-st2-pack-${pack}"]
}

0 comments on commit 17a7c6c

Please sign in to comment.