foreman_osc 0.1.0 → 0.2.0

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 78500a3fb33cf8393b20a90d8f398402243bc1d2
4
- data.tar.gz: faf9f9f026132d39f520a63441e98baebf0adea4
3
+ metadata.gz: fa1b7e9f14e2be3a0141a1e2861e8a08272bcf35
4
+ data.tar.gz: 55c0fb8da8cc7ba7646e889426154fed79f4c34f
5
5
  SHA512:
6
- metadata.gz: 84bd79796497db336a81fe2f716077697e45e5ec348ec5bc72279d613f0a00abb969493a3fea988db68f5c852ee8774445db01d7e57ebaea1d564f1fdf21ea58
7
- data.tar.gz: 0d742af97b67b241bb37b0318327fa7634286fa1e4b0fb7c85668f0e492aee08014b7801b0450abb26cc332270ebf8ac72b485c36e28a8a1ddda1d65803e0f43
6
+ metadata.gz: 830b66222476379daea7072a33c330b40c4e4b634dc9df97d2b0b6473bae3883948796f1ea5f47f2879d18d771addb05a1069a3fd82c96d4a128ee9ed0552df9
7
+ data.tar.gz: 4b4fa425a604ed34644a5d143e45522a9a14c6b62270a7f5604a3665ccb66bd429a7d63e6a1a84a0a0f636bab055d9675d347410475e362e5dc027897f33c52f
@@ -4,7 +4,8 @@ module ForemanOsc
4
4
 
5
5
  included do
6
6
  after_update :sync_tftp, if: :tftp_parameter_updated?
7
- after_create :sync_tftp, if: :tftp_parameter_created?
7
+ after_create :sync_tftp, if: :tftp_parameter?
8
+ after_destroy :sync_tftp, if: :tftp_parameter?
8
9
  end
9
10
 
10
11
  def tftp_parameters
@@ -19,6 +20,7 @@ module ForemanOsc
19
20
  end
20
21
 
21
22
  def sync_tftp
23
+ Foreman::Logging.logger('foreman_osc/tftp_sync').info("HIT sync_tftp")
22
24
  if self.class.name == 'GroupParameter'
23
25
  hosts = self.hostgroup.hosts
24
26
  if hosts.empty?
@@ -31,11 +33,18 @@ module ForemanOsc
31
33
  end
32
34
 
33
35
  hosts.each do |host|
34
- Foreman::Logging.logger('foreman_osc/tftp_sync').info(host.name)
36
+ if host.provision_interface.present? and host.tftp?
37
+ if host.provision_interface.rebuild_tftp
38
+ Foreman::Logging.logger('foreman_osc/tftp_sync').info("TFTP sync #{host}...SUCCESS")
39
+ else
40
+ Foreman::Logging.logger('foreman_osc/tftp_sync').info("TFTP sync #{host}...FAIL")
41
+ end
42
+ end
35
43
  end
36
44
  end
37
45
 
38
46
  def tftp_parameter_updated?
47
+ Foreman::Logging.logger('foreman_osc/tftp_sync').info("HIT tftp_parameter_updated")
39
48
  if self.tftp_parameters.include?(self.name) && self.value_changed?
40
49
  return true
41
50
  else
@@ -43,7 +52,8 @@ module ForemanOsc
43
52
  end
44
53
  end
45
54
 
46
- def tftp_parameter_created?
55
+ def tftp_parameter?
56
+ Foreman::Logging.logger('foreman_osc/tftp_sync').info("HIT tftp_parameter")
47
57
  if self.tftp_parameters.include?(self.name)
48
58
  return true
49
59
  else
@@ -4,7 +4,7 @@ module ForemanOsc
4
4
  class Engine < ::Rails::Engine
5
5
  engine_name 'foreman_osc'
6
6
 
7
- config.autoload_paths += Dir["#{config.root}/app/models/concerns"]
7
+ #config.autoload_paths += Dir["#{config.root}/app/models/concerns"]
8
8
 
9
9
  initializer 'foreman_osc.register_plugin', :before => :finisher_hook do |_app|
10
10
  Foreman::Plugin.register :foreman_osc do
@@ -18,6 +18,7 @@ module ForemanOsc
18
18
  load 'osc.rake'
19
19
  end
20
20
 
21
+ =begin
21
22
  config.to_prepare do
22
23
  begin
23
24
  Parameter.send(:include, ForemanOsc::ParameterExtensions)
@@ -25,6 +26,6 @@ module ForemanOsc
25
26
  Rails.logger.warn "ForemanOsc: skipping engine hook (#{e})"
26
27
  end
27
28
  end
28
-
29
+ =end
29
30
  end
30
31
  end
@@ -1,3 +1,3 @@
1
1
  module ForemanOsc
2
- VERSION = '0.1.0'.freeze
2
+ VERSION = '0.2.0'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: foreman_osc
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Trey Dockendorf
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-11-07 00:00:00.000000000 Z
11
+ date: 2016-11-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: deface