foreman_hooks 0.3.7 → 0.3.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +14 -0
  3. data/lib/foreman_hooks/util.rb +7 -8
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 97c36beb194d82ae065e7406562726963aaf6879
4
- data.tar.gz: 67f0434ca73f34dbc158ef028fcf4e2120c5d790
3
+ metadata.gz: a218348f896e043f637737ed1c14bdbcd14060bd
4
+ data.tar.gz: 68eb1264e93c645d1364161558c3c28adb0c63cb
5
5
  SHA512:
6
- metadata.gz: 54368599bd9b7b0624b51be7a574c237609d76b9c60a2f696f4a6947797fe17c4eb2241f7b8c7867614cb119e8b1248514824063d17f9e9c00daa100b6e1507c
7
- data.tar.gz: 11a59aa886d2d1b6129837c18ecda49e7ea40767c5fc09edf3db3fba4e3934cebd1aef5116ae3b6d756227324cf94a69d78301f1c62b111cae661ab3d83e9a81
6
+ metadata.gz: d3bcc0e43b0b3661891da6cf79bfeb015684555ad29d7b185495b067606fba11587aa8ba215025b032acd1e2ef2d68b7170c638fcd6127899ae1554e3f36558e
7
+ data.tar.gz: df5ed8979e28adf964da737b382825e2697bba28953a02767d7adcf18c8f8a09c20c7799d4144eb801d94bc9f01005dd4cec80b5a642d8f2728dee0fa2dfadcb
data/README.md CHANGED
@@ -34,6 +34,19 @@ Examples:
34
34
 
35
35
  (`host/managed` is for Foreman 1.2+, change to just `host` for Foreman 1.1)
36
36
 
37
+ ## SELinux notes
38
+
39
+ When using official installation on Red Hat and Fedora system, note that
40
+ SELinux is turned on by default and Foreman is running in confined mode. Make
41
+ sure that hook scripts has the correct context (`foreman_hook_t` on
42
+ RHEL7+/Fedora 19+ or `bin_t` on RHEL6):
43
+
44
+ restorecon -RvF /usr/share/foreman/config/hooks
45
+
46
+ Also keep in mind that the script is running confined, therefore some actions
47
+ might be denied by SELinux. Check audit.log and use audit2allow and other
48
+ tools when writing scripts.
49
+
37
50
  ## Objects / Models
38
51
 
39
52
  Every object (or model in Rails terms) in Foreman can have hooks. Check
@@ -115,6 +128,7 @@ called with "destroy" if it has to be rolled back later).
115
128
  * [Extending Foreman quickly with hook scripts](http://m0dlx.com/blog/Extending_Foreman_quickly_with_hook_scripts.html)
116
129
  * [AWS VPC Buildout With Foreman Hooks for RDNS Creation](http://www.brian2.net/posts/foreman_hooks_aws_vpc/)
117
130
  * [Foreman <-> FreeIPA Integration Guide](https://bitbin.de/blog/2013/11/foreman-freeipa-integration-guide/)
131
+ * [Autostart Libvirt/KVM VMs in Foreman](http://www.uberobert.com/autostart-libvirt-vms-in-foreman/)
118
132
 
119
133
  # Copyright
120
134
 
@@ -25,14 +25,13 @@ module ForemanHooks::Util
25
25
 
26
26
  def exec_hook(*args)
27
27
  logger.debug "Running hook: #{args.join(' ')}"
28
- success = if defined? Bundler && Bundler.responds_to(:with_clean_env)
29
- Bundler.with_clean_env { exec_hook_int(render_hook_json, *args) }
30
- else
31
- exec_hook_int(render_hook_json, *args)
32
- end.success?
33
-
28
+ success, output = if defined? Bundler && Bundler.responds_to(:with_clean_env)
29
+ Bundler.with_clean_env { exec_hook_int(render_hook_json, *args) }
30
+ else
31
+ exec_hook_int(render_hook_json, *args)
32
+ end
34
33
  # Raising here causes Foreman Orchestration to correctly show error bubble in GUI
35
- raise ForemanHooks::Error.new "Hook failure running `#{args.join(' ')}`: #{$?}" unless success
34
+ raise ForemanHooks::Error.new "Hook failure running `#{args.join(' ')}`: #{$?} #{output}" unless success
36
35
  success
37
36
  end
38
37
 
@@ -49,6 +48,6 @@ module ForemanHooks::Util
49
48
  [output, $?]
50
49
  end
51
50
  logger.debug "Hook output: #{output}" if output && !output.empty?
52
- status
51
+ [status.success?, output]
53
52
  end
54
53
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: foreman_hooks
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.7
4
+ version: 0.3.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dominic Cleal
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-02-26 00:00:00.000000000 Z
11
+ date: 2015-07-30 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Plugin engine for Foreman that enables running custom hook scripts on
14
14
  Foreman events