From fdda3ee0ecedd0c3a2108dd1b6c33991f225f20f Mon Sep 17 00:00:00 2001 From: isaac-hammes Date: Thu, 26 Oct 2023 09:10:23 -0700 Subject: [PATCH] Revert "(PA-5786) Add ability to execute direct post installation scriptlets" This reverts commit 93ba1b4ee3d7b5f15951b2a6eee0043faa16dc06. --- lib/vanagon/component.rb | 4 ---- lib/vanagon/component/dsl.rb | 10 ---------- lib/vanagon/project.rb | 12 ------------ resources/rpm/project.spec.erb | 11 ----------- 4 files changed, 37 deletions(-) diff --git a/lib/vanagon/component.rb b/lib/vanagon/component.rb index 7692bbda..18d7ac6a 100644 --- a/lib/vanagon/component.rb +++ b/lib/vanagon/component.rb @@ -106,9 +106,6 @@ class Component # activate_triggers is a one-dimentional Array of Strings, describing scripts that # should be executed when a package identifies an activate trigger attr_accessor :activate_triggers - # postinstall_required_actions is a two-dimensional Array, describing scripts that - # must be executed successfully after a given component is installed. - attr_accessor :postinstall_required_actions # postinstall_actions is a two-dimensional Array, describing scripts that # should be executed after a given component is installed. attr_accessor :postinstall_actions @@ -179,7 +176,6 @@ def initialize(name, settings, platform) # rubocop:disable Metrics/AbcSize @install_triggers = [] @interest_triggers = [] @activate_triggers = [] - @postinstall_required_actions = [] @postinstall_actions = [] @preremove_actions = [] @postremove_actions = [] diff --git a/lib/vanagon/component/dsl.rb b/lib/vanagon/component/dsl.rb index 7c404ecb..ec763032 100644 --- a/lib/vanagon/component/dsl.rb +++ b/lib/vanagon/component/dsl.rb @@ -503,16 +503,6 @@ def add_debian_activate_triggers(activate_name) @component.activate_triggers << OpenStruct.new(:activate_name => activate_name) end - # Add post installation action that must exit successfully before restarting the service - # - # @param pkg_state [Array] the state in which the scripts should execute. Can be - # one or multiple of 'install' and 'upgrade'. - # @param scripts [Array] the Bourne shell compatible scriptlet(s) to execute - def add_postinstall_required_action(pkg_state, scripts) - check_pkg_state_array(pkg_state) - @component.postinstall_required_actions << OpenStruct.new(:pkg_state => Array(pkg_state), :scripts => Array(scripts)) - end - # Adds action to run during the postinstall phase of packaging # # @param pkg_state [Array] the state in which the scripts should execute. Can be diff --git a/lib/vanagon/project.rb b/lib/vanagon/project.rb index 03cebc0e..59ad0ff1 100644 --- a/lib/vanagon/project.rb +++ b/lib/vanagon/project.rb @@ -494,18 +494,6 @@ def get_postinstall_actions(pkg_state) end end - # Collects the postinstall packaging actions that must exit successfully for the project and it's components - # for the specified packaging state - # - # @param pkg_state [String] the package state we want to run the given scripts for. - # Can be one of 'install' or 'upgrade' - # @return [String] string of Bourne shell compatible scriptlets to execute during the postinstall - # phase of packaging during the state of the system defined by pkg_state (either install or upgrade) - def get_postinstall_required_actions(pkg_state) - scripts = components.flat_map(&:postinstall_required_actions).compact.select { |s| s.pkg_state.include? pkg_state }.map(&:scripts) - return ': no postinstall required scripts provided' if scripts.empty? - scripts.join("\n") - end # Collects the preremove packaging actions for the project and it's components # for the specified packaging state # diff --git a/resources/rpm/project.spec.erb b/resources/rpm/project.spec.erb index 8f10fad3..2b80388b 100644 --- a/resources/rpm/project.spec.erb +++ b/resources/rpm/project.spec.erb @@ -242,17 +242,6 @@ fi %post -# Run required postinstall scripts on install if defined -if [ -e %{_localstatedir}/lib/rpm-state/%{name}/install ] ; then - <%= get_postinstall_required_actions("install") %> - rm %{_localstatedir}/lib/rpm-state/%{name}/install -fi - -# Run required postinstall scripts on upgrade if defined -if [ -e %{_localstatedir}/lib/rpm-state/%{name}/upgrade ] ; then - <%= get_postinstall_required_actions("upgrade") %> - rm %{_localstatedir}/lib/rpm-state/%{name}/upgrade -fi <%- if @platform.is_aix? || (@platform.is_el? && @platform.os_version.to_i == 4) -%> ## EL-4 and AIX RPM don't have %posttrans, so we'll put them here # Run postinstall scripts on install if defined