foreman_teamdynamix 0.3.0 → 0.3.1
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 +4 -4
- data/app/services/teamdynamix_api.rb +6 -9
- data/lib/foreman_teamdynamix/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 974e51f269a04f84aa99266dd76a488927667da2
|
|
4
|
+
data.tar.gz: 5d4c695293adfa740cb5c2dcb628c595462a4345
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 04ae93412cac67b3e2d5e7e735b0667ddd5148494f3606aeb90888c2f8f81fcbd1f17b0954e3ffe526c9a777860334af618626a85905befb07aa367071bb14aa
|
|
7
|
+
data.tar.gz: 3036f05cc758d96733126f2b02841c24a66cbeba5cabf96f70891fedf4b48fbe6c4c99abcf72c98fe5e71a2baafed66c53f7295cc2efcd29eba5b5ea8cd9a924
|
|
@@ -116,22 +116,19 @@ class TeamdynamixApi
|
|
|
116
116
|
default_attrs = { AppID: APP_ID,
|
|
117
117
|
SerialNumber: host.name,
|
|
118
118
|
Name: host.fqdn }
|
|
119
|
-
create_attrs = API_CONFIG[:create]
|
|
120
|
-
evaluate_attributes(create_attrs, host)
|
|
119
|
+
create_attrs = evaluate_attributes(API_CONFIG[:create], host)
|
|
121
120
|
default_attrs.merge(create_attrs)
|
|
122
121
|
end
|
|
123
122
|
|
|
124
123
|
def evaluate_attributes(create_attrs, host)
|
|
125
|
-
create_attrs.
|
|
124
|
+
create_attrs.symbolize_keys.each_with_object({}) do |(k, v), h|
|
|
126
125
|
if k.eql?(:Attributes)
|
|
127
|
-
v.
|
|
128
|
-
attribute.transform_keys
|
|
129
|
-
|
|
130
|
-
v.delete(attribute) if attribute['value'].nil?
|
|
126
|
+
h[:Attributes] = v.each_with_object([]) do |attribute, a|
|
|
127
|
+
a << attribute.transform_keys(&:downcase)
|
|
128
|
+
a.last['value'] = eval_attribute(a.last['value'], host)
|
|
131
129
|
end
|
|
132
130
|
else
|
|
133
|
-
|
|
134
|
-
create_attrs.delete(k) if create_attrs[k].nil?
|
|
131
|
+
h[k] = eval_attribute(v, host)
|
|
135
132
|
end
|
|
136
133
|
end
|
|
137
134
|
end
|