Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions .github/workflows/pr_testing.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ name: 'PR Tests'
on:
push:
branches:
- master
- main
pull_request:
branches:
- master
- main

jobs:
shellcheck:
Expand All @@ -20,21 +20,21 @@ jobs:
run: shellcheck tasks/*.sh

test-install-task-on-ubuntu:
runs-on: ubuntu-latest
# Perforce hasn't yet released bolt on 24.04.
runs-on: ubuntu-22.04
needs: shellcheck
steps:
- uses: actions/checkout@v4
# - name: Install dependencies
# run: sudo apt wget
- name: Install Bolt
run: |-
wget https://apt.puppet.com/puppet-tools-release-noble.deb
sudo dpkg -i puppet-tools-release-noble.deb
wget https://apt.puppet.com/puppet-tools-release-jammy.deb
sudo dpkg -i puppet-tools-release-jammy.deb
sudo apt update
sudo apt install -y puppet-bolt
- name: Install module dependencies
run: bolt module install
- name: Run openvox-agent install task
run: bolt task run openvox_bootstrap::install --targets localhost
run: bolt task run openvox_bootstrap::install --targets localhost --run-as root
- name: Verify openvox-agent is installed
run: puppet --version
run: |-
[[ "$(/opt/puppetlabs/bin/puppet --version)" =~ [0-9]+\.[0-9]+\.[0-9]+ ]]
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
.modules
.plan_cache.json
.rerun.json
.resource_types
.task_cache.json
Puppetfile
10 changes: 7 additions & 3 deletions tasks/install.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,19 @@
"apt_source": {
"description": "The apt source repository to retrieve deb packages from.",
"type": "Optional[String]",
"default": "http://apt.overlookinfratech.com"
"default": "https://apt.overlookinfratech.com"
},
"yum_source": {
"description": "The yum source repository to retrieve rpm packages from.",
"type": "Optional[String]",
"default": "http://yum.overlookinfratech.com"
"default": "https://yum.overlookinfratech.com"
}
},
"implementations": [
{"name": "install_linux.sh", "requirements": ["shell"]}
{
"name": "install_linux.sh",
"requirements": ["shell"],
"files": ["facts/tasks/bash.sh"]
}
]
}
40 changes: 29 additions & 11 deletions tasks/install_linux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ set_platform() {
full_version=$(bash "${facts}" release)
assigned 'full_version'
else
fail "Unable to find the puppetlabs-facts bash task to determine platform."
fail "Unable to find the puppetlabs-facts bash task to determine platform at '${facts}'."
fi
}

Expand Down Expand Up @@ -140,21 +140,37 @@ set_collection_url() {
else
package_name="${collection}-release-${family}${full_version}.${package_file_suffix}"
fi
package_url="https://${repository}/${package_name}"
package_url="${repository}/${package_name}"

assigned 'package_name'
assigned 'package_url'
}

exec_and_capture() {
local _cmd="$*"

info "Executing: ${_cmd}"
local _result

set +e
result=$(${_cmd} 2>&1)
local _status=$?
set -e

echo "${result}"
info "Status: ${_status}"
return $_status
}

# Download the given url to the given local file path.
download() {
local _url="$1"
local _file="$2"

if exists 'wget'; then
wget -O "${_file}" "${_url}"
exec_and_capture wget -O "${_file}" "${_url}"
elif exists 'curl'; then
curl -sSL -o "${_file}" "${_url}"
exec_and_capture curl -sSL -o "${_file}" "${_url}"
else
fail "Unable to download ${_url}. Neither wget nor curl are installed."
fi
Expand All @@ -180,13 +196,14 @@ install_release_package() {
local _package_type="$1"
local _package_file="$2"

info "Installing release package: ${_package_file}"
case $_package_type in
rpm)
rpm -Uvh "$_package_file"
exec_and_capture rpm -Uvh "$_package_file"
;;
deb)
dpkg -i "$_package_file"
apt update
exec_and_capture dpkg -i "$_package_file"
exec_and_capture apt update
;;
*)
fail "Unhandled package type: '${package_type}'"
Expand All @@ -197,14 +214,15 @@ install_release_package() {
install_package() {
local _package="$1"

info "Installing ${_package}"
if exists 'dnf'; then
dnf install -y "$_package"
exec_and_capture dnf install -y "$_package"
elif exists 'yum'; then
yum install -y "$_package"
exec_and_capture yum install -y "$_package"
elif exists 'zypper'; then
zypper install -y "$_package"
exec_and_capture zypper install -y "$_package"
elif exists 'apt'; then
apt install -y "$_package"
exec_and_capture apt install -y "$_package"
else
fail "Unable to install ${_package}. Neither dnf, yum, zypper, nor apt are installed."
fi
Expand Down