rubix 0.0.11 → 0.0.12

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 (3) hide show
  1. data/VERSION +1 -1
  2. data/lib/rubix/sender.rb +16 -2
  3. metadata +3 -3
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.11
1
+ 0.0.12
data/lib/rubix/sender.rb CHANGED
@@ -109,8 +109,22 @@ module Rubix
109
109
  # @return [Rubix::Host]
110
110
  def initialize_host
111
111
  self.host = (Host.find(:name => settings['host']) || Host.new(:name => settings['host']))
112
- host.host_groups = ((host.host_groups || []) + host_groups).flatten.compact.uniq
113
- host.templates = ((host.templates || []) + templates).flatten.compact.uniq
112
+
113
+ current_host_group_names = (host.host_groups || []).map(&:name)
114
+ current_template_names = (host.templates || []).map(&:name)
115
+
116
+ host_groups_to_add, templates_to_add = [], []
117
+
118
+ (self.host_groups || []).each do |hg|
119
+ host_groups_to_add << hg unless current_host_group_names.include?(hg.name)
120
+ end
121
+
122
+ (self.templates || []).each do |t|
123
+ templates_to_add << t unless current_template_names.include?(t.name)
124
+ end
125
+
126
+ host.host_groups = ((host.host_groups || []) + host_groups_to_add).flatten.compact.uniq
127
+ host.templates = ((host.templates || []) + templates_to_add).flatten.compact.uniq
114
128
  host.save
115
129
  host
116
130
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubix
3
3
  version: !ruby/object:Gem::Version
4
- hash: 9
4
+ hash: 7
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 11
10
- version: 0.0.11
9
+ - 12
10
+ version: 0.0.12
11
11
  platform: ruby
12
12
  authors:
13
13
  - Dhruv Bansal