Skip to content
Closed
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
124 changes: 104 additions & 20 deletions oc-chef-pedant/Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -45,23 +45,23 @@ GEM
public_suffix (>= 2.0.2, < 7.0)
ast (2.4.3)
aws-eventstream (1.4.0)
aws-partitions (1.1175.0)
aws-sdk-core (3.234.0)
aws-partitions (1.1179.0)
aws-sdk-core (3.236.0)
aws-eventstream (~> 1, >= 1.3.0)
aws-partitions (~> 1, >= 1.992.0)
aws-sigv4 (~> 1.9)
base64
bigdecimal
jmespath (~> 1, >= 1.6.1)
logger
aws-sdk-kms (1.115.0)
aws-sdk-kms (1.116.0)
aws-sdk-core (~> 3, >= 3.234.0)
aws-sigv4 (~> 1.5)
aws-sdk-s3 (1.201.0)
aws-sdk-s3 (1.202.0)
aws-sdk-core (~> 3, >= 3.234.0)
aws-sdk-kms (~> 1)
aws-sigv4 (~> 1.5)
aws-sdk-secretsmanager (1.121.0)
aws-sdk-secretsmanager (1.122.0)
aws-sdk-core (~> 3, >= 3.234.0)
aws-sigv4 (~> 1.5)
aws-sigv4 (1.12.1)
Expand Down Expand Up @@ -108,6 +108,54 @@ GEM
uri (~> 1.0.3)
uuidtools (>= 2.1.5, < 3.0)
vault (~> 0.18.2)
chef (18.8.46-universal-mingw-ucrt)
activesupport (>= 4.2.7.1, <= 7.1.5.2)
addressable
aws-sdk-s3 (~> 1.91)
aws-sdk-secretsmanager (~> 1.46)
chef-config (= 18.8.46)
chef-powershell (~> 18.1.0)
chef-utils (= 18.8.46)
chef-vault
chef-zero (>= 15.0.21)
corefoundation (~> 0.3.4)
diff-lcs (>= 1.2.4, < 1.6.0, != 1.4.0)
erubis (~> 2.7)
ffi (>= 1.15.5, <= 1.16.3)
ffi-libarchive (~> 1.0, >= 1.0.3)
ffi-yajl (~> 2.2)
iniparse (~> 1.4)
inspec-core (>= 5, < 6)
iso8601 (>= 0.12.1, < 0.14)
license-acceptance (>= 1.0.5, < 3)
mixlib-archive (>= 0.4, < 2.0)
mixlib-authentication (>= 2.1, < 4)
mixlib-cli (>= 2.1.1, < 3.0)
mixlib-log (>= 2.0.3, < 3.2)
mixlib-shellout (>= 3.1.1, < 4.0)
net-ftp
net-sftp (>= 2.1.2, < 5.0)
ohai (~> 18.0)
plist (~> 3.2)
proxifier2 (~> 1.1)
syslog-logger (~> 1.6)
train-core (~> 3.13, >= 3.13.4)
train-rest (>= 0.4.1)
train-winrm (~> 0.2.17)
unf_ext (~> 0.0.8.2)
uri (~> 1.0.3)
uuidtools (>= 2.1.5, < 3.0)
vault (~> 0.18.2)
win32-api (~> 1.10.0)
win32-certstore (~> 0.6.15)
win32-event (~> 0.6.1)
win32-eventlog (= 0.6.3)
win32-mmap (~> 0.4.1)
win32-mutex (~> 0.4.2)
win32-process (~> 0.9)
win32-service (>= 2.1.5, < 3.0)
win32-taskscheduler (~> 2.0)
wmi-lite (~> 1.0)
chef-config (18.8.46)
addressable
chef-utils (= 18.8.46)
Expand All @@ -118,6 +166,9 @@ GEM
chef-gyoku (1.4.5)
builder (>= 2.1.2)
rexml (~> 3.4)
chef-powershell (18.1.0)
ffi (~> 1.15)
ffi-yajl (~> 2.4)
chef-telemetry (1.1.1)
chef-config
concurrent-ruby (~> 1.0)
Expand Down Expand Up @@ -145,8 +196,7 @@ GEM
erubi (>= 1.7)
logging (>= 1.6.1, < 3.0)
rubyzip (~> 2.0)
chef-zero (15.0.21)
activesupport (>= 7, < 8.1)
chef-zero (15.0.26)
ffi-yajl (>= 2.2, < 4.0)
hashie (>= 2.0, < 6.0)
mixlib-log (>= 2.0, < 4.0)
Expand All @@ -158,11 +208,11 @@ GEM
coderay (1.1.3)
concurrent-ruby (1.3.5)
connection_pool (2.5.4)
cookstyle (8.5.0)
rubocop (= 1.81.0)
cookstyle (8.5.2)
rubocop (= 1.81.6)
corefoundation (0.3.13)
ffi (>= 1.15.0)
date (3.4.1)
date (3.5.0)
debug_inspector (1.2.0)
diff-lcs (1.5.1)
domain_name (0.6.20240107)
Expand All @@ -178,8 +228,11 @@ GEM
faraday-net_http (3.4.1)
net-http (>= 0.5.0)
ffi (1.16.3)
ffi (1.16.3-x64-mingw-ucrt)
ffi-libarchive (1.1.14)
ffi (~> 1.0)
ffi-win32-extensions (1.0.4)
ffi
ffi-yajl (2.6.0)
libyajl2 (>= 1.2)
fiddle (1.1.8)
Expand Down Expand Up @@ -220,8 +273,9 @@ GEM
tty-prompt (~> 0.17)
tty-table (~> 0.10)
ipaddress (0.8.3)
iso8601 (0.13.0)
jmespath (1.6.2)
json (2.15.1)
json (2.15.2)
language_server-protocol (3.17.0.5)
libyajl2 (2.1.0)
license-acceptance (2.1.13)
Expand All @@ -241,7 +295,7 @@ GEM
mime-types-data (~> 3.2025, >= 3.2025.0507)
mime-types-data (3.2025.0924)
minitest (5.26.0)
mixlib-archive (1.1.7)
mixlib-archive (1.3.3)
mixlib-log
mixlib-authentication (3.0.10)
mixlib-cli (2.1.8)
Expand All @@ -251,13 +305,18 @@ GEM
ffi (< 1.17.0)
mixlib-shellout (3.3.9)
chef-utils
mixlib-shellout (3.3.9-x64-mingw-ucrt)
chef-utils
ffi-win32-extensions (~> 1.0.3)
win32-process (~> 0.9)
wmi-lite (~> 1.0)
multi_json (1.17.0)
multipart-post (2.4.1)
mutex_m (0.3.0)
net-ftp (0.3.8)
net-ftp (0.3.9)
net-protocol
time
net-http (0.6.0)
net-http (0.7.0)
uri
net-http-spy (0.2.1)
net-protocol (0.2.2)
Expand All @@ -284,7 +343,7 @@ GEM
train-core
wmi-lite (~> 1.0)
parallel (1.27.0)
parser (3.3.9.0)
parser (3.3.10.0)
ast (~> 2.4.1)
racc
parslet (2.0.0)
Expand All @@ -304,11 +363,11 @@ GEM
pry (~> 0.13)
public_suffix (6.0.2)
racc (1.8.1)
rack (3.2.3)
rack (3.2.4)
rackup (2.2.1)
rack (>= 3)
rainbow (3.1.1)
rake (13.3.0)
rake (13.3.1)
regexp_parser (2.11.3)
rexml (3.4.4)
rspec (3.13.2)
Expand All @@ -323,15 +382,15 @@ GEM
rspec-its (2.0.0)
rspec-core (>= 3.13.0)
rspec-expectations (>= 3.13.0)
rspec-mocks (3.13.6)
rspec-mocks (3.13.7)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.13.0)
rspec-rerun (1.1.0)
rspec (~> 3.0)
rspec-support (3.13.6)
rspec_junit_formatter (0.6.0)
rspec-core (>= 2, < 4, != 2.12.0)
rubocop (1.81.0)
rubocop (1.81.6)
json (~> 2.3)
language_server-protocol (~> 3.17.0.2)
lint_roller (~> 1.1.0)
Expand All @@ -356,13 +415,14 @@ GEM
unicode-display_width (>= 1.5, < 3.0)
unicode_utils (~> 1.4)
strings-ansi (0.2.0)
structured_warnings (0.5.0)
syslog (0.3.0)
logger
syslog-logger (1.6.8)
thor (1.4.0)
time (0.4.1)
date
timeout (0.4.3)
timeout (0.4.4)
tomlrb (1.3.0)
train-core (3.13.4)
addressable (~> 2.5)
Expand Down Expand Up @@ -400,18 +460,42 @@ GEM
tzinfo (2.0.6)
concurrent-ruby (~> 1.0)
unf_ext (0.0.8.2)
unf_ext (0.0.8.2-x64-mingw-ucrt)
unicode-display_width (2.6.0)
unicode_utils (1.4.0)
uri (1.0.4)
uuidtools (2.2.0)
vault (0.18.2)
aws-sigv4
webrick (1.9.1)
win32-api (1.10.1-universal-mingw32)
win32-certstore (0.6.16)
chef-powershell
ffi
win32-event (0.6.3)
win32-ipc (>= 0.6.0)
win32-eventlog (0.6.3)
ffi
win32-ipc (0.7.0)
ffi
win32-mmap (0.4.2)
ffi
win32-mutex (0.4.3)
win32-ipc (>= 0.6.0)
win32-process (0.10.0)
ffi (>= 1.0.0)
win32-service (2.3.2)
ffi
ffi-win32-extensions
win32-taskscheduler (2.0.4)
ffi
structured_warnings
wisper (2.0.1)
wmi-lite (1.0.7)

PLATFORMS
ruby
x64-mingw-ucrt
x86_64-linux

DEPENDENCIES
Expand Down
40 changes: 31 additions & 9 deletions oc-chef-pedant/lib/pedant/concern.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,38 @@
# See the License for the specific language governing permissions and
# limitations under the License.

# ActiveSupport::Concern is needed to help abstract out the boilerplate for creating includable modules
# TODO: Consider embedding active_support/concern directly. The difference in license will have to be addressed.

require "active_support/concern"
# Minimal implementation of the Concern pattern to replace ActiveSupport::Concern
# This provides the 'included' hook functionality and ClassMethods extension needed by Pedant modules

module Pedant
Concern = ActiveSupport::Concern
module Concern
def self.extended(base)
base.instance_variable_set(:@_dependencies, [])
end

def included(base = nil, &block)
if base.nil?
raise ArgumentError, "Missing argument: `included' expects a block or a base module" unless block_given?

@_included_block = block
else
super
end
end

# This is a trick passed on by Dan Deleo. This creates a module Pedant::Concern that
# is exactly ActiveSupport::Concern. We can then reference Pedant::Concern instead of
# ActiveSupport::Concern. If we want to embed ActiveSupport::Concern, we can fill out
# Pedant::Concern without having to do a massive refactor.
def append_features(base)
# Execute the included block in the context of the base class
if instance_variable_defined?(:@_included_block)
base.class_eval(&@_included_block)
end

# Automatically extend base with ClassMethods if it exists
# This is the key feature of ActiveSupport::Concern
if const_defined?(:ClassMethods)
base.extend const_get(:ClassMethods)
end

super
end
end
end
11 changes: 10 additions & 1 deletion oc-chef-pedant/lib/pedant/rspec/role_util.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,21 @@

require "pedant/request"
require "rspec/core/shared_context"
require "active_support/core_ext/hash/keys"
require "pedant/concern"

# Simple hash helper to replace ActiveSupport's stringify_keys
module HashStringifyKeys
refine Hash do
def stringify_keys
transform_keys(&:to_s)
end
end
end

module Pedant
module RSpec
module RoleUtil
using HashStringifyKeys
extend ::RSpec::Core::SharedContext
extend ::Pedant::Concern

Expand Down
5 changes: 5 additions & 0 deletions oc-chef-pedant/spec/api/clients/complete_endpoint_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@

describe "Client API endpoint", :clients do
include Pedant::RSpec::ClientUtil
# Explicitly extend client util class-level macros to ensure availability in nested contexts.
# In some CI environments ActiveSupport::Concern did not attach ClassMethods early enough,
# leading to NameError: undefined method `should_create_public_key`. This safeguard makes
# the macro definitions (e.g., should_create_public_key, should_update_public_key) available.
extend Pedant::RSpec::ClientUtil::ClassMethods unless respond_to?(:should_create_public_key)

# Just until we rename the requestors
let(:admin_requestor) { org_admin }
Expand Down
Loading