Skip to content

Commit

Permalink
update unless
Browse files Browse the repository at this point in the history
  • Loading branch information
JP-Odido committed Dec 12, 2023
1 parent b9796a2 commit ae765b9
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions manifests/repo.pp
Original file line number Diff line number Diff line change
Expand Up @@ -89,12 +89,6 @@
Optional[String] $url = undef,
) {
include ::helm::params
if $repo_config != undef {
$unless_repo = "helm repo list --repository-config ${repo_config} | awk '{if(NR>1)print \$1}' | grep -w ${repo_name}"
} else {
$unless_repo = "helm repo list | awk '{if(NR>1)print \$1}' | grep -w ${repo_name}"
}
notify { "unless_repo -> '${unless_repo}'": }
if $ensure == present {
$helm_repo_add_flags = helm_repo_add_flags({
ensure => $ensure,
Expand All @@ -117,6 +111,12 @@
}
)
$exec_repo = "helm repo add ${helm_repo_add_flags}"
if $repo_config != undef {
$unless_repo = "helm repo list --repository-config ${repo_config} | awk '{if (\$1 == \"${repo_name}\") exit 0}'"
} else {
$unless_repo = "helm repo list | awk '{if (\$1 == \"${repo_name}\") exit 0}'"
}
notify { "unless_repo -> '${unless_repo}'": }
}

if $ensure == absent {
Expand All @@ -133,6 +133,12 @@
}
)
$exec_repo = "helm repo remove ${helm_repo_remove_flags}"
if $repo_config != undef {
$unless_repo = "helm repo list --repository-config ${repo_config} | awk '{if (\$1 == \"${repo_name}\") exit 1}'"
} else {
$unless_repo = "helm repo list | awk '{if (\$1 == \"${repo_name}\") exit 1}'"
}
notify { "unless_repo -> '${unless_repo}'": }
}

exec { "helm repo ${repo_name}":
Expand Down

0 comments on commit ae765b9

Please sign in to comment.