vanagon 0.39.3 → 0.40.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1ed8da3751c29acb70fea9bff9eb49263409066fe80d8b2d44554988768f02d7
4
- data.tar.gz: a5f496b8508eee638db7cb797ae824f1b4beb5b046c67bba9efbd8f30de5faf7
3
+ metadata.gz: 49e90bdaa700172f444cb3849dfbaa7d422c4912f081eb45a3466a45857b23d6
4
+ data.tar.gz: b88bbbadd07826f06f05d0ae766048af7e3bba74a859bc029c35bedcda6d710e
5
5
  SHA512:
6
- metadata.gz: f3ad3013534e4f40bcc5972efac9397477ab3e636e391e669215d44b06130a7d8a379b6cc67c95127081e1c3b58167744f4db6a943d35ea0160312a875dc43b5
7
- data.tar.gz: faecaa5fe8ec3dc0e8174f766bb0849f94ca8b3b35f70cb19faea91985365bda45da16820b3aadb27dcf0a101bec39f8b46075e6b65547b18cb1c0ddd45224e8
6
+ metadata.gz: 188b11f3ca921713dba0f9c790b5bec8039dd3d2fe79488a76f4cb065ac616cc98ea3af03a5d7c78d29070d5bea547d8dc977beeaddfccf988f3dc738cbd18a2
7
+ data.tar.gz: e7d53de5ec39fbc9975e610f987511dbcf652ece373d7d2ed72c6965f5c358c734410f2992de2918bd38d5402fccdb9a753ada37a05c205fb0eee1143d340664
@@ -503,6 +503,16 @@ class Vanagon
503
503
  @component.activate_triggers << OpenStruct.new(:activate_name => activate_name)
504
504
  end
505
505
 
506
+ # Add post installation action that must exit successfully before restarting the service
507
+ #
508
+ # @param pkg_state [Array] the state in which the scripts should execute. Can be
509
+ # one or multiple of 'install' and 'upgrade'.
510
+ # @param scripts [Array] the Bourne shell compatible scriptlet(s) to execute
511
+ def add_postinstall_required_action(pkg_state, scripts)
512
+ check_pkg_state_array(pkg_state)
513
+ @component.postinstall_required_actions << OpenStruct.new(:pkg_state => Array(pkg_state), :scripts => Array(scripts))
514
+ end
515
+
506
516
  # Adds action to run during the postinstall phase of packaging
507
517
  #
508
518
  # @param pkg_state [Array] the state in which the scripts should execute. Can be
@@ -106,6 +106,9 @@ class Vanagon
106
106
  # activate_triggers is a one-dimentional Array of Strings, describing scripts that
107
107
  # should be executed when a package identifies an activate trigger
108
108
  attr_accessor :activate_triggers
109
+ # postinstall_required_actions is a two-dimensional Array, describing scripts that
110
+ # must be executed successfully after a given component is installed.
111
+ attr_accessor :postinstall_required_actions
109
112
  # postinstall_actions is a two-dimensional Array, describing scripts that
110
113
  # should be executed after a given component is installed.
111
114
  attr_accessor :postinstall_actions
@@ -176,6 +179,7 @@ class Vanagon
176
179
  @install_triggers = []
177
180
  @interest_triggers = []
178
181
  @activate_triggers = []
182
+ @postinstall_required_actions = []
179
183
  @postinstall_actions = []
180
184
  @preremove_actions = []
181
185
  @postremove_actions = []
@@ -494,6 +494,18 @@ class Vanagon
494
494
  end
495
495
  end
496
496
 
497
+ # Collects the postinstall packaging actions that must exit successfully for the project and it's components
498
+ # for the specified packaging state
499
+ #
500
+ # @param pkg_state [String] the package state we want to run the given scripts for.
501
+ # Can be one of 'install' or 'upgrade'
502
+ # @return [String] string of Bourne shell compatible scriptlets to execute during the postinstall
503
+ # phase of packaging during the state of the system defined by pkg_state (either install or upgrade)
504
+ def get_postinstall_required_actions(pkg_state)
505
+ scripts = components.flat_map(&:postinstall_required_actions).compact.select { |s| s.pkg_state.include? pkg_state }.map(&:scripts)
506
+ return ': no postinstall required scripts provided' if scripts.empty?
507
+ scripts.join("\n")
508
+ end
497
509
  # Collects the preremove packaging actions for the project and it's components
498
510
  # for the specified packaging state
499
511
  #
@@ -242,6 +242,17 @@ fi
242
242
 
243
243
 
244
244
  %post
245
+ # Run required postinstall scripts on install if defined
246
+ if [ -e %{_localstatedir}/lib/rpm-state/%{name}/install ] ; then
247
+ <%= get_postinstall_required_actions("install") %>
248
+ rm %{_localstatedir}/lib/rpm-state/%{name}/install
249
+ fi
250
+
251
+ # Run required postinstall scripts on upgrade if defined
252
+ if [ -e %{_localstatedir}/lib/rpm-state/%{name}/upgrade ] ; then
253
+ <%= get_postinstall_required_actions("upgrade") %>
254
+ rm %{_localstatedir}/lib/rpm-state/%{name}/upgrade
255
+ fi
245
256
  <%- if @platform.is_aix? || (@platform.is_el? && @platform.os_version.to_i == 4) -%>
246
257
  ## EL-4 and AIX RPM don't have %posttrans, so we'll put them here
247
258
  # Run postinstall scripts on install if defined
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vanagon
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.39.3
4
+ version: 0.40.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Puppet By Perforce
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-09-29 00:00:00.000000000 Z
11
+ date: 2023-10-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: docopt