Showing with 98 additions and 268 deletions.
  1. +5 −16 .fixtures.yml
  2. +19 −0 .github/workflows/jira.yml
  3. +2 −40 .github/workflows/static_code_analysis.yaml
  4. +1 −2 .rubocop.yml
  5. +2 −0 .sync.yml
  6. +12 −0 CHANGELOG.md
  7. +0 −132 CONTRIBUTING.md
  8. +54 −51 files/rb_task_helper.rb
  9. +2 −2 metadata.json
  10. +0 −25 rakelib/commits.rake
  11. +1 −0 tasks/install_shell.sh
21 changes: 5 additions & 16 deletions .fixtures.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,7 @@
fixtures:
repositories:
stdlib: 'https://github.com/puppetlabs/puppetlabs-stdlib'
forge_modules:
inifile:
repo: "puppetlabs/inifile"
ref: "5.3.0"
apt:
repo: "puppetlabs/apt"
ref: "9.0.0"
translate:
repo: "puppetlabs/translate"
ref: "1.2.0"
yumrepo_core:
repo: "puppetlabs/yumrepo_core"
facts:
repo: "puppetlabs/facts"
ref: "1.4.0"
stdlib: https://github.com/puppetlabs/puppetlabs-stdlib.git
apt: https://github.com/puppetlabs/puppetlabs-apt.git
inifile: https://github.com/puppetlabs/puppetlabs-inifile.git
yumrepo_core: https://github.com/puppetlabs/puppetlabs-yumrepo_core.git
facts: https://github.com/puppetlabs/puppetlabs-facts.git
19 changes: 19 additions & 0 deletions .github/workflows/jira.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
name: Export issue to Jira

on:
issues:
types: [labeled]

permissions:
issues: write

jobs:
export:
uses: "puppetlabs/phoenix-github-actions/.github/workflows/jira.yml@main"
with:
jira-project: PA
jira-base-url: ${{ vars.jira_base_url }}
jira-user-email: ${{ vars.jira_user_email }}
secrets:
jira-api-token: ${{ secrets.JIRA_ISSUES_ACTION }}
42 changes: 2 additions & 40 deletions .github/workflows/static_code_analysis.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,46 +6,8 @@ on:
branches: [ main ]
pull_request:
branches: [ main ]
workflow_dispatch:

jobs:
static_code_analysis:
name: Run checks

env:
ruby_version: '2.7'

runs-on: 'ubuntu-20.04'
steps:
- name: Checkout current PR code
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Install ruby version ${{ env.ruby_version }}
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ env.ruby_version }}

- name: Prepare testing environment with bundler
run: |
git config --global core.longpaths true
bundle config set --local without 'release'
bundle update --jobs 4 --retry 3
- name: Run commits check
run: bundle exec rake commits

- name: Run validate check
run: bundle exec rake validate

- name: Run lint check
run: bundle exec rake lint

- name: Run metadata_lint check
run: bundle exec rake metadata_lint

- name: Run syntax check
run: bundle exec rake syntax syntax:hiera syntax:manifests syntax:templates

- name: Run rubocop check
run: bundle exec rake rubocop
uses: "puppetlabs/phoenix-github-actions/.github/workflows/static_code_analysis.yaml@main"
3 changes: 1 addition & 2 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,7 @@ Style/BlockDelimiters:
be consistent then.
EnforcedStyle: braces_for_chaining
Style/ClassAndModuleChildren:
Description: Compact style reduces the required amount of indentation.
EnforcedStyle: compact
Enabled: false
Style/EmptyElse:
Description: Enforce against empty else clauses, but allow `nil` for clarity.
EnforcedStyle: empty
Expand Down
2 changes: 2 additions & 0 deletions .sync.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
Enabled: false
RSpec/SubjectStub:
Enabled: false
Style/ClassAndModuleChildren:
Enabled: false
Gemfile:
optional:
":development":
Expand Down
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,18 @@ All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org).

## [v4.17.0](https://github.com/puppetlabs/puppetlabs-puppet_agent/tree/v4.17.0) - 2023-12-08

[Full Changelog](https://github.com/puppetlabs/puppetlabs-puppet_agent/compare/v4.16.0...v4.17.0)

### Added

- Add Linux Mint LDME6 [#686](https://github.com/puppetlabs/puppetlabs-puppet_agent/pull/686) ([luckyraul](https://github.com/luckyraul))

### Fixed

- (maint) Unnest module and class names in Ruby tasks [#687](https://github.com/puppetlabs/puppetlabs-puppet_agent/pull/687) ([MartyEwings](https://github.com/MartyEwings))

## [v4.16.0](https://github.com/puppetlabs/puppetlabs-puppet_agent/tree/v4.16.0) - 2023-11-15

[Full Changelog](https://github.com/puppetlabs/puppetlabs-puppet_agent/compare/v4.15.0...v4.16.0)
Expand Down
132 changes: 0 additions & 132 deletions CONTRIBUTING.md

This file was deleted.

105 changes: 54 additions & 51 deletions files/rb_task_helper.rb
Original file line number Diff line number Diff line change
@@ -1,59 +1,62 @@
# frozen_string_literal: true

# Puppet Agent task helper
module PuppetAgent::RbTaskHelper
private

def error_result(error_type, error_message)
{
'_error' => {
'msg' => error_message,
'kind' => error_type,
'details' => {},
},
}
end

def puppet_bin_present?
File.exist?(puppet_bin)
end

# Returns the path to the Puppet agent executable
def puppet_bin
@puppet_bin ||= if Puppet.features.microsoft_windows?
puppet_bin_windows
else
'/opt/puppetlabs/bin/puppet'
end
end

# Returns the path to the Puppet agent executable on Windows
def puppet_bin_windows
require 'win32/registry'

install_dir = begin
Win32::Registry::HKEY_LOCAL_MACHINE.open('SOFTWARE\Puppet Labs\Puppet') do |reg|
# Rescue missing key
dir = begin
reg['RememberedInstallDir64']
rescue StandardError
''
end
# Both keys may exist, make sure the dir exists
break dir if File.exist?(dir)

# Rescue missing key
begin
reg['RememberedInstallDir']
rescue StandardError
''
module PuppetAgent
# Puppet Agent Ruby task helper
module RbTaskHelper
private

def error_result(error_type, error_message)
{
'_error' => {
'msg' => error_message,
'kind' => error_type,
'details' => {},
},
}
end

def puppet_bin_present?
File.exist?(puppet_bin)
end

# Returns the path to the Puppet agent executable
def puppet_bin
@puppet_bin ||= if Puppet.features.microsoft_windows?
puppet_bin_windows
else
'/opt/puppetlabs/bin/puppet'
end
end

# Returns the path to the Puppet agent executable on Windows
def puppet_bin_windows
require 'win32/registry'

install_dir = begin
Win32::Registry::HKEY_LOCAL_MACHINE.open('SOFTWARE\Puppet Labs\Puppet') do |reg|
# Rescue missing key
dir = begin
reg['RememberedInstallDir64']
rescue StandardError
''
end
# Both keys may exist, make sure the dir exists
break dir if File.exist?(dir)

# Rescue missing key
begin
reg['RememberedInstallDir']
rescue StandardError
''
end
end
rescue Win32::Registry::Error
# Rescue missing registry path
''
end
rescue Win32::Registry::Error
# Rescue missing registry path
''
end

File.join(install_dir, 'bin', 'puppet.bat')
File.join(install_dir, 'bin', 'puppet.bat')
end
end
end
4 changes: 2 additions & 2 deletions metadata.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{
"name": "puppetlabs-puppet_agent",
"version": "4.16.0",
"version": "4.17.0",
"author": "puppetlabs",
"summary": "Upgrades All-In-One Puppet Agents",
"license": "Apache-2.0",
"source": "https://github.com/puppetlabs/puppetlabs-puppet_agent",
"project_page": "https://github.com/puppetlabs/puppetlabs-puppet_agent",
"issues_url": "http://tickets.puppetlabs.com/browse/MODULES",
"issues_url": "https://github.com/puppetlabs/puppetlabs-puppet_agent/issues",
"dependencies": [
{
"name": "puppetlabs-stdlib",
Expand Down
Loading