dop_common 0.15.1 → 0.15.2

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,15 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 07527d17d603f0e24a7ac08b22e97a4d6b8d68c7
4
- data.tar.gz: e3db1d8a02b4a4b8c6ed3ca1f7a5d718d9a3ae3a
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ NWFiYTM0NDlhNjg1ODcwNGQ2ZjJiNjM1ZTc2Yjc2ZDgwYTU0ZGZmNg==
5
+ data.tar.gz: !binary |-
6
+ MjJkN2YwYWZlODRhYzNkN2E5NTU1ZTIyM2Q1ZGQ1Zjg5ZDQ5NDlhYg==
5
7
  SHA512:
6
- metadata.gz: ec7e26b4587ededd9eb60174fb9e81d7e4c4f992a23a4cb0bf96230f6ed048b7008fe53dd73fc0b4cb8f783cdbb78e2eba4862bfab30a8645d94b2399694908d
7
- data.tar.gz: a261d97e99b4a56976f1e12bb8eed7044e86798cd358f6fe2d271313eb17c4c5c0d801bc2dc715abf6f2905838350bba9292fc7d65863688b80a6b0d23e3c378
8
+ metadata.gz: !binary |-
9
+ ZDkyODg2YmNjYWY4Yjg2YTg2NWVmNDFkNGI5ZmZmNDIyODIxOTZlZTcyZjhh
10
+ N2RlNTJmMDEzNmExNzAxNTgyZGZlMzlhMTEzNjgwODE3MWY5ZWFlZTYyNzIy
11
+ ZjdmN2Y3ZTBiZjNmMzA5N2M2NTJiZjc1MDhkOGU4MjVjNDlmMTc=
12
+ data.tar.gz: !binary |-
13
+ MTZiZjZlNjk4OTY1NGYzNWQ2NDJkZTM1MWZmZWQ4OTZkN2I5YzlmOWQyMmMx
14
+ ZDUwZGNlMjc2YTk3NjY1NjJiMjAwZDcxYjIxMmNjNTk5MGJhZGM3YzY2ZGNl
15
+ N2EzMmRhNjRlNzQ0Nzg4ODAzY2JmZGQ2MTg0YTBhMWUxNzlhZTQ=
data/CHANGELOG.md CHANGED
@@ -1,6 +1,10 @@
1
1
  # Change Log
2
2
  All notable changes to dop_common will be documented in this file.
3
3
 
4
+ ## [0.15.2]
5
+ ### Added
6
+ - Add node list property tags for vmware / vsphere
7
+
4
8
  ## [0.15.1]
5
9
  ### Fixed
6
10
  - Fix the default plan store path for the hiera plugin and add some more tests
@@ -478,9 +478,9 @@ a property name is actually a keyword of a node hash.
478
478
 
479
479
  8. __*credentials*__ - an optional property to define credentials for
480
480
  administrator user (root, Administrator). This information is passed to
481
- the customization tool (cloud-init, VSphere customization, etc.). Following
481
+ the customization tool (cloud-init, VSphere-based windows-guests customization, etc.). Following
482
482
  data can be specified:
483
- * __*root_password*__ - super user password that is set for cloud init phase,
483
+ * __*root_password*__ - super user password that is set for cloud init phase (IMPORTANT: not supported in VSphere).
484
484
  * __*root_ssh_keys*__ - an array of OpenSSH public keys that are recorded
485
485
  into `/root/.ssh/authorized_keys` by cloud init.
486
486
  * __*administrator_password*__ - an optional property that specifies the
@@ -535,7 +535,7 @@ a property name is actually a keyword of a node hash.
535
535
  __IMPORTANT:__ This property is required when customizing guest on *VSPhere* provider.
536
536
 
537
537
  14. __*product_id*__ - an optional, VSphere-specific windows-only guest customization
538
- property that specifies a serial number. Its default value is
538
+ property that specifies a serial number. The default value is
539
539
  undefined which leaves the guest OS in an evaluation/trial mode.
540
540
 
541
541
  15. __*organization_name*__ - a required, VSphere-specific windows-only guest
@@ -556,6 +556,14 @@ a property name is actually a keyword of a node hash.
556
556
 
557
557
  __IMPORTANT__: Do not use this property for other cloud provider types than VSphere.
558
558
 
559
+ 18. __*tags*__ - a optional, VSphere-specific, property that instructs the VSphere provider
560
+ to associate the given node with the listed tags
561
+
562
+ __IMPORTANT__: Do not use this property for other cloud provider types than VSphere.
563
+ __IMPORTANT__: Requires minimum version 6.0.0 of VSphere.
564
+ __IMPORTANT__: Raises an error if the tag does not exist.
565
+
566
+
559
567
  The example bellow shows a specification for a database backend and a web node:
560
568
  ```yaml
561
569
  nodes:
@@ -78,6 +78,7 @@ module DopCommon
78
78
  log_validation_method('credentials_valid?')
79
79
  log_validation_method('dns_valid?')
80
80
  log_validation_method('data_disks_valid?')
81
+ log_validation_method('tags_valid?')
81
82
  try_validate_obj("Node #{@name}: Can't validate the interfaces part because of a previous error"){interfaces}
82
83
  try_validate_obj("Node #{@name}: Can't validate the infrastructure_properties part because of a previous error"){infrastructure_properties}
83
84
  try_validate_obj("Node #{@name}: Can't validate the dns part because of a previous error"){dns}
@@ -194,6 +195,10 @@ module DopCommon
194
195
  @parsed_hooks
195
196
  end
196
197
 
198
+ def tags
199
+ @tags ||= tags_valid? ? create_tags : nil
200
+ end
201
+
197
202
  protected
198
203
 
199
204
  attr_writer :name
@@ -453,5 +458,24 @@ module DopCommon
453
458
  )
454
459
  end
455
460
  end
461
+
462
+ def tags_valid?
463
+ return false if @hash[:tags].nil?
464
+ raise PlanParsingError, "Node #{@node}: The 'thin_clone' can be used only for VSphere provider" unless
465
+ (infrastructure.provides?(:vsphere) || infrastructure.provides?(:vmware))
466
+ [String, Symbol, Array].include?(@hash[:tags].class) or
467
+ raise PlanParsingError, "Node #{name}: 'tags' has to be a string, symbol or array"
468
+ [@hash[:tags]].flatten.each do |tag|
469
+ [String, Symbol].include?(tag.class) or
470
+ raise PlanParsingError, "Node #{name}: the 'tags' array should only contain strings, symbols"
471
+ end
472
+ end
473
+
474
+
475
+ def create_tags
476
+ [@hash[:tags]].flatten.map do |tag|
477
+ tag.to_s
478
+ end
479
+ end
456
480
  end
457
481
  end
@@ -1,3 +1,3 @@
1
1
  module DopCommon
2
- VERSION = '0.15.1'
2
+ VERSION = '0.15.2'
3
3
  end
@@ -670,4 +670,55 @@ describe DopCommon::Node do
670
670
  end
671
671
  end
672
672
  end
673
+
674
+
675
+ describe '#tags' do
676
+ it 'will return nil if tags not specified' do
677
+ node = DopCommon::Node.new(
678
+ 'dummy',
679
+ {'infrastructure' => 'vsphere'},
680
+ {:parsed_infrastructures => @infrastructures}
681
+ )
682
+ expect(node.tags).to be_nil
683
+ end
684
+ it 'will return a value if specified properly' do
685
+ node = DopCommon::Node.new(
686
+ 'dummy',
687
+ {'infrastructure' => 'vsphere', 'tags' => ['tag_a', 'tag_c']},
688
+ {:parsed_infrastructures => @infrastructures}
689
+ )
690
+ expect(node.tags).to eq(['tag_a', 'tag_c'])
691
+ node = DopCommon::Node.new(
692
+ 'dummy',
693
+ {'infrastructure' => 'vsphere', 'tags' => [:tag_b]},
694
+ {:parsed_infrastructures => @infrastructures}
695
+ )
696
+ expect(node.tags).to eq(['tag_b'])
697
+ end
698
+ it 'will raise an error if "tags" is of invalid type' do
699
+ node = DopCommon::Node.new(
700
+ 'dummy',
701
+ {'infrastructure' => 'vsphere', 'tags' => false},
702
+ {:parsed_infrastructures => @infrastructures}
703
+ )
704
+ expect{node.tags}.to raise_error DopCommon::PlanParsingError
705
+ end
706
+
707
+ it 'will return nil in case of invalid provider type' do
708
+ node = DopCommon::Node.new(
709
+ 'dummy',
710
+ {'infrastructure' => 'rhev'},
711
+ {:parsed_infrastructures => @infrastructures}
712
+ )
713
+ expect(node.tags).to be_nil
714
+ end
715
+ it 'will raise an error if "tags" specified in case of invalid provider type' do
716
+ node = DopCommon::Node.new(
717
+ 'dummy',
718
+ {'infrastructure' => 'rhev', 'tags' => ['tag_a']},
719
+ {:parsed_infrastructures => @infrastructures}
720
+ )
721
+ expect{node.tags}.to raise_error DopCommon::PlanParsingError
722
+ end
723
+ end
673
724
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dop_common
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.15.1
4
+ version: 0.15.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andreas Zuber
@@ -9,186 +9,185 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2017-06-28 00:00:00.000000000 Z
12
+ date: 2018-05-28 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: hashdiff
16
16
  requirement: !ruby/object:Gem::Requirement
17
17
  requirements:
18
- - - "~>"
18
+ - - ~>
19
19
  - !ruby/object:Gem::Version
20
20
  version: '0.3'
21
- - - ">="
21
+ - - ! '>='
22
22
  - !ruby/object:Gem::Version
23
23
  version: 0.3.1
24
24
  type: :runtime
25
25
  prerelease: false
26
26
  version_requirements: !ruby/object:Gem::Requirement
27
27
  requirements:
28
- - - "~>"
28
+ - - ~>
29
29
  - !ruby/object:Gem::Version
30
30
  version: '0.3'
31
- - - ">="
31
+ - - ! '>='
32
32
  - !ruby/object:Gem::Version
33
33
  version: 0.3.1
34
34
  - !ruby/object:Gem::Dependency
35
35
  name: lockfile
36
36
  requirement: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - "~>"
38
+ - - ~>
39
39
  - !ruby/object:Gem::Version
40
40
  version: '2'
41
41
  type: :runtime
42
42
  prerelease: false
43
43
  version_requirements: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - "~>"
45
+ - - ~>
46
46
  - !ruby/object:Gem::Version
47
47
  version: '2'
48
48
  - !ruby/object:Gem::Dependency
49
49
  name: rb-inotify
50
50
  requirement: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - "~>"
52
+ - - ~>
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0.9'
55
55
  type: :runtime
56
56
  prerelease: false
57
57
  version_requirements: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - "~>"
59
+ - - ~>
60
60
  - !ruby/object:Gem::Version
61
61
  version: '0.9'
62
62
  - !ruby/object:Gem::Dependency
63
63
  name: bundler
64
64
  requirement: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - ">="
66
+ - - ! '>='
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
69
  type: :development
70
70
  prerelease: false
71
71
  version_requirements: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - ">="
73
+ - - ! '>='
74
74
  - !ruby/object:Gem::Version
75
75
  version: '0'
76
76
  - !ruby/object:Gem::Dependency
77
77
  name: rake
78
78
  requirement: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - ">="
80
+ - - ! '>='
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
83
  type: :development
84
84
  prerelease: false
85
85
  version_requirements: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - ">="
87
+ - - ! '>='
88
88
  - !ruby/object:Gem::Version
89
89
  version: '0'
90
90
  - !ruby/object:Gem::Dependency
91
91
  name: rspec
92
92
  requirement: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - ">="
94
+ - - ! '>='
95
95
  - !ruby/object:Gem::Version
96
96
  version: '0'
97
97
  type: :development
98
98
  prerelease: false
99
99
  version_requirements: !ruby/object:Gem::Requirement
100
100
  requirements:
101
- - - ">="
101
+ - - ! '>='
102
102
  - !ruby/object:Gem::Version
103
103
  version: '0'
104
104
  - !ruby/object:Gem::Dependency
105
105
  name: rspec-legacy_formatters
106
106
  requirement: !ruby/object:Gem::Requirement
107
107
  requirements:
108
- - - ">="
108
+ - - ! '>='
109
109
  - !ruby/object:Gem::Version
110
110
  version: '0'
111
111
  type: :development
112
112
  prerelease: false
113
113
  version_requirements: !ruby/object:Gem::Requirement
114
114
  requirements:
115
- - - ">="
115
+ - - ! '>='
116
116
  - !ruby/object:Gem::Version
117
117
  version: '0'
118
118
  - !ruby/object:Gem::Dependency
119
119
  name: rspec-mocks
120
120
  requirement: !ruby/object:Gem::Requirement
121
121
  requirements:
122
- - - ">="
122
+ - - ! '>='
123
123
  - !ruby/object:Gem::Version
124
124
  version: '0'
125
125
  type: :development
126
126
  prerelease: false
127
127
  version_requirements: !ruby/object:Gem::Requirement
128
128
  requirements:
129
- - - ">="
129
+ - - ! '>='
130
130
  - !ruby/object:Gem::Version
131
131
  version: '0'
132
132
  - !ruby/object:Gem::Dependency
133
133
  name: rspec-collection_matchers
134
134
  requirement: !ruby/object:Gem::Requirement
135
135
  requirements:
136
- - - ">="
136
+ - - ! '>='
137
137
  - !ruby/object:Gem::Version
138
138
  version: '0'
139
139
  type: :development
140
140
  prerelease: false
141
141
  version_requirements: !ruby/object:Gem::Requirement
142
142
  requirements:
143
- - - ">="
143
+ - - ! '>='
144
144
  - !ruby/object:Gem::Version
145
145
  version: '0'
146
146
  - !ruby/object:Gem::Dependency
147
147
  name: simplecov
148
148
  requirement: !ruby/object:Gem::Requirement
149
149
  requirements:
150
- - - ">="
150
+ - - ! '>='
151
151
  - !ruby/object:Gem::Version
152
152
  version: '0'
153
153
  type: :development
154
154
  prerelease: false
155
155
  version_requirements: !ruby/object:Gem::Requirement
156
156
  requirements:
157
- - - ">="
157
+ - - ! '>='
158
158
  - !ruby/object:Gem::Version
159
159
  version: '0'
160
160
  - !ruby/object:Gem::Dependency
161
161
  name: pry
162
162
  requirement: !ruby/object:Gem::Requirement
163
163
  requirements:
164
- - - ">="
164
+ - - ! '>='
165
165
  - !ruby/object:Gem::Version
166
166
  version: '0'
167
167
  type: :development
168
168
  prerelease: false
169
169
  version_requirements: !ruby/object:Gem::Requirement
170
170
  requirements:
171
- - - ">="
171
+ - - ! '>='
172
172
  - !ruby/object:Gem::Version
173
173
  version: '0'
174
174
  - !ruby/object:Gem::Dependency
175
175
  name: pry-doc
176
176
  requirement: !ruby/object:Gem::Requirement
177
177
  requirements:
178
- - - ">="
178
+ - - ! '>='
179
179
  - !ruby/object:Gem::Version
180
180
  version: '0'
181
181
  type: :development
182
182
  prerelease: false
183
183
  version_requirements: !ruby/object:Gem::Requirement
184
184
  requirements:
185
- - - ">="
185
+ - - ! '>='
186
186
  - !ruby/object:Gem::Version
187
187
  version: '0'
188
- description: |2
189
- This gem is part of the Deployment and Orchestration for Puppet
190
- or DOP for short. dop_common is a library for the parsing and
191
- validation of DOP plan files.
188
+ description: ! " This gem is part of the Deployment and Orchestration for Puppet\n
189
+ \ or DOP for short. dop_common is a library for the parsing and\n validation
190
+ of DOP plan files.\n"
192
191
  email:
193
192
  - zuber@puzzle.ch
194
193
  - pavol.dilung@swisscom.com
@@ -197,9 +196,9 @@ executables:
197
196
  extensions: []
198
197
  extra_rdoc_files: []
199
198
  files:
200
- - ".gitignore"
201
- - ".rspec"
202
- - ".ruby-version"
199
+ - .gitignore
200
+ - .rspec
201
+ - .ruby-version
203
202
  - CHANGELOG.md
204
203
  - Gemfile
205
204
  - LICENSE.txt
@@ -299,17 +298,18 @@ require_paths:
299
298
  - lib
300
299
  required_ruby_version: !ruby/object:Gem::Requirement
301
300
  requirements:
302
- - - ">="
301
+ - - ! '>='
303
302
  - !ruby/object:Gem::Version
304
- version: 1.8.7
303
+ version: !binary |-
304
+ MS44Ljc=
305
305
  required_rubygems_version: !ruby/object:Gem::Requirement
306
306
  requirements:
307
- - - ">="
307
+ - - ! '>='
308
308
  - !ruby/object:Gem::Version
309
309
  version: '0'
310
310
  requirements: []
311
311
  rubyforge_project:
312
- rubygems_version: 2.6.10
312
+ rubygems_version: 2.6.14
313
313
  signing_key:
314
314
  specification_version: 4
315
315
  summary: DOP plan file parser and validation library