From ab90dcbd35d0cdee57885b4b893228b4e33a7728 Mon Sep 17 00:00:00 2001 From: Olle Jonsson Date: Mon, 16 Sep 2024 11:05:53 +0200 Subject: [PATCH 1/2] Remove unused require in test The OpenStruct library was not used in that test. ostruct raises a warning about not being a shipped-and-bundled-with-Ruby standard library in Ruby 3.5.0. --- spec/foreman/process_spec.rb | 1 - 1 file changed, 1 deletion(-) diff --git a/spec/foreman/process_spec.rb b/spec/foreman/process_spec.rb index d449c956..58e21020 100644 --- a/spec/foreman/process_spec.rb +++ b/spec/foreman/process_spec.rb @@ -1,6 +1,5 @@ require 'spec_helper' require 'foreman/process' -require 'ostruct' require 'timeout' require 'tmpdir' From a463ccc43383f494f9c433641983e897fd43d6e3 Mon Sep 17 00:00:00 2001 From: Olle Jonsson Date: Mon, 16 Sep 2024 11:13:05 +0200 Subject: [PATCH 2/2] Avoid ostruct usage ...in order to avoid Ruby warnings in Ruby 3.5.0 about ostruct not being a built-in library. --- lib/foreman/export/base.rb | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/lib/foreman/export/base.rb b/lib/foreman/export/base.rb index 010529e6..2abb9c05 100644 --- a/lib/foreman/export/base.rb +++ b/lib/foreman/export/base.rb @@ -1,5 +1,4 @@ require "foreman/export" -require "ostruct" require "pathname" require "shellwords" @@ -13,6 +12,9 @@ class Foreman::Export::Base # deprecated attr_reader :port + # deprecated + ProcessStruct = Struct.new(:name, :process) + def initialize(location, engine, options={}) @location = location @engine = engine @@ -35,10 +37,7 @@ def template def @engine.procfile Foreman::Export::Base.warn_deprecation! @processes.map do |process| - OpenStruct.new( - :name => @names[process], - :process => process - ) + ProcessStruct.new(@names[process], process) end end end