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
2 changes: 1 addition & 1 deletion .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -200,5 +200,5 @@ jobs:
repo_token: ${{ secrets.GITHUB_TOKEN }}
slack_webhook_url: ${{ secrets.SLACK_WEBHOOK }}
# Optional Input
channel: '#team-ia-bots'
channel: '#team-cat-bots'
name: 'GABot'
8 changes: 4 additions & 4 deletions .github/workflows/spec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,10 @@ jobs:
buildevents step $TRACE_ID $STEP_ID $STEP_START 'Setup Environment'
echo STEP_ID=Setup-Acceptance-Test-Matrix >> $GITHUB_ENV
echo STEP_START=$(date +%s) >> $GITHUB_ENV
# - name: Run Static & Syntax Tests
# if: ${{ github.repository_owner == 'puppetlabs' }}
# run: |
# buildevents cmd $TRACE_ID $STEP_ID 'static_syntax_checks' -- bundle exec rake syntax lint metadata_lint check:symlinks check:git_ignore check:dot_underscore check:test_file rubocop
- name: Run Static & Syntax Tests
if: ${{ github.repository_owner == 'puppetlabs' }}
run: |
buildevents cmd $TRACE_ID $STEP_ID 'static_syntax_checks' -- bundle exec rake syntax lint metadata_lint check:symlinks check:git_ignore check:dot_underscore check:test_file rubocop
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't really understand why this is so complex. It can be this easy:

Suggested change
buildevents cmd $TRACE_ID $STEP_ID 'static_syntax_checks' -- bundle exec rake syntax lint metadata_lint check:symlinks check:git_ignore check:dot_underscore check:test_file rubocop
buildevents cmd $TRACE_ID $STEP_ID 'static_syntax_checks' -- bundle exec rake validate lint check rubocop

I also submitted a PR for this in puppetlabs/pdk-templates#441 but it looks like this is lost somehow?


- name: Setup Spec Test Matrix
id: get-matrix
Expand Down
48 changes: 24 additions & 24 deletions functions/ensure.pp
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
# @summary function to cast ensure parameter to resource specific value
function stdlib::ensure(
Variant[Boolean, Enum['present', 'absent']] $ensure,
Enum['directory', 'link', 'mounted', 'service', 'file', 'package'] $resource,
Variant[Boolean, Enum['present', 'absent']] $ensure,
Enum['directory', 'link', 'mounted', 'service', 'file', 'package'] $resource,
) >> String {
$_ensure = $ensure ? {
Boolean => $ensure.bool2str('present', 'absent'),
default => $ensure,
$_ensure = $ensure ? {
Boolean => $ensure.bool2str('present', 'absent'),
default => $ensure,
}
case $resource {
'package': {
$_ensure ? {
'present' => 'installed',
default => 'absent',
}
}
case $resource {
'package': {
$_ensure ? {
'present' => 'installed',
default => 'absent',
}
}
'service': {
$_ensure ? {
'present' => 'running',
default => 'stopped',
}
}
default: {
$_ensure ? {
'present' => $resource,
default => $_ensure,
}
}
'service': {
$_ensure ? {
'present' => 'running',
default => 'stopped',
}
}
default: {
$_ensure ? {
'present' => $resource,
default => $_ensure,
}
}
}
}
12 changes: 5 additions & 7 deletions lib/puppet/parser/functions/validate_integer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -119,13 +119,11 @@ module Puppet::Parser::Functions
when Array
# check every element of the array
input.each_with_index do |arg, pos|
begin
raise TypeError if arg.is_a?(Hash)
arg = Integer(arg.to_s)
validator.call(arg)
rescue TypeError, ArgumentError
raise Puppet::ParseError, "validate_integer(): Expected element at array position #{pos} to be an Integer, got #{arg.class}"
end
raise TypeError if arg.is_a?(Hash)
arg = Integer(arg.to_s)
validator.call(arg)
rescue TypeError, ArgumentError
raise Puppet::ParseError, "validate_integer(): Expected element at array position #{pos} to be an Integer, got #{arg.class}"
end
# for the sake of compatibility with ruby 1.8, we need extra handling of hashes
when Hash
Expand Down
12 changes: 5 additions & 7 deletions lib/puppet/parser/functions/validate_numeric.rb
Original file line number Diff line number Diff line change
Expand Up @@ -79,13 +79,11 @@ module Puppet::Parser::Functions
when Array
# check every element of the array
input.each_with_index do |arg, pos|
begin
raise TypeError if arg.is_a?(Hash)
arg = Float(arg.to_s)
validator.call(arg)
rescue TypeError, ArgumentError
raise Puppet::ParseError, "validate_numeric(): Expected element at array position #{pos} to be a Numeric, got #{arg.class}"
end
raise TypeError if arg.is_a?(Hash)
arg = Float(arg.to_s)
validator.call(arg)
rescue TypeError, ArgumentError
raise Puppet::ParseError, "validate_numeric(): Expected element at array position #{pos} to be a Numeric, got #{arg.class}"
end
# for the sake of compatibility with ruby 1.8, we need extra handling of hashes
when Hash
Expand Down
2 changes: 1 addition & 1 deletion metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -115,5 +115,5 @@
"description": "Standard Library for Puppet Modules",
"pdk-version": "2.3.0",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isn't pdk-version supposed to be 2.4.0?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah, the version updated in between the original commit and when I added the fixes and exclusions. Since this one required no exclusions a second pdksync wasn't run

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is fine to merge.
It doesn't really mean much

"template-url": "https://github.com/puppetlabs/pdk-templates#main",
"template-ref": "heads/main-0-gf3911d3"
"template-ref": "heads/main-0-g806810b"
}