foreman_teamdynamix 0.2.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +7 -4
- data/app/services/teamdynamix_api.rb +17 -4
- data/lib/foreman_teamdynamix/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1cd084945a1d6d14d7cfd2a24ae43dd2cedfd342
|
4
|
+
data.tar.gz: a9000907c7c653d1d52ecd7d06057b79a4d246b0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f9f3ace967bd42994303b182e4ef60896610e9bc7e6416ebae1140c9d7bad0e30611a7e6bbfb2a037aa2fde65d7daf4f2fd9d522f1bced591608c17013812f30
|
7
|
+
data.tar.gz: 95cbe16944f53abc9090b882d73d10e9d2842046328d6802f628db595541d2085e4c5d7b86e3aaee09c24d2145c924293145a9b66299f3adbc14bcd77720e280
|
data/README.md
CHANGED
@@ -29,17 +29,20 @@ Example Configuration
|
|
29
29
|
:password: 'xxxxxx'
|
30
30
|
:create:
|
31
31
|
:StatusID: 641
|
32
|
-
:
|
32
|
+
:AcquisitionDate: host.created_at
|
33
|
+
:OwningCustomerName: "'foreman_teamdynamix_plugin_test'"
|
33
34
|
:Attributes:
|
34
35
|
- name: mu.ci.Lifecycle Status
|
35
36
|
id: 11634
|
36
37
|
value: 26190
|
37
38
|
- name: mu.ci.Description
|
38
39
|
id: 11632
|
39
|
-
value:
|
40
|
+
value: >-
|
41
|
+
"created by ForemanTeamdynamix plugin, owner is #{host.owner_id}"
|
40
42
|
- name: Ticket Routing Details
|
41
43
|
id: 11636
|
42
|
-
value:
|
44
|
+
value: >-
|
45
|
+
"Asset for host running on OS #{host.operatingsystem_id}"
|
43
46
|
:delete:
|
44
47
|
:StatusId: 642
|
45
48
|
:fields:
|
@@ -59,7 +62,7 @@ Example Configuration
|
|
59
62
|
* To configure any [Custom Attributes](https://api.teamdynamix.com/TDWebApi/Home/type/TeamDynamix.Api.CustomAttributes.CustomAttribute) for the asset.
|
60
63
|
* It must contain expected value for 'id' and 'value' fields.
|
61
64
|
* rest of the fields are optional, check the Custom Attribute's definition for what other fields are updatable.
|
62
|
-
*
|
65
|
+
* Code evaluation is supported for custom attribute's value.
|
63
66
|
|
64
67
|
[:fields]
|
65
68
|
* The keys are the display title and the values are the methods that are actually called to produce the value.
|
@@ -122,13 +122,26 @@ class TeamdynamixApi
|
|
122
122
|
end
|
123
123
|
|
124
124
|
def evaluate_attributes(create_attrs, host)
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
125
|
+
create_attrs.each do |k, v|
|
126
|
+
if k.eql?(:Attributes)
|
127
|
+
v.each do |attribute|
|
128
|
+
attribute.transform_keys!(&:downcase)
|
129
|
+
attribute['value'] = eval_attribute(attribute['value'], host)
|
130
|
+
v.delete(attribute) if attribute['value'].nil?
|
131
|
+
end
|
132
|
+
else
|
133
|
+
create_attrs[k] = eval_attribute(v, host)
|
134
|
+
create_attrs.delete(k) if create_attrs[k].nil?
|
135
|
+
end
|
129
136
|
end
|
130
137
|
end
|
131
138
|
|
139
|
+
def eval_attribute(value, host)
|
140
|
+
eval(value.to_s, binding, __FILE__, __LINE__) # rubocop:disable Security/Eval
|
141
|
+
rescue StandardError
|
142
|
+
nil
|
143
|
+
end
|
144
|
+
|
132
145
|
def must_configure_create_params
|
133
146
|
[:StatusID]
|
134
147
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: foreman_teamdynamix
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nipendar Tyagi
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-04-
|
11
|
+
date: 2018-04-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: deface
|