chef-provisioning-vsphere 2.2.2 → 2.3.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: 37f82ea348c58634c6971b8714c71b31c91c0cc5
4
- data.tar.gz: d31a7417afd87dd0b475a81ffb529a6c990de31e
3
+ metadata.gz: fee187b088f7b218b9e783f294da04188b0e38ba
4
+ data.tar.gz: 1fcb11378516dc70fc0a1acd9b2381cc58c219ca
5
5
  SHA512:
6
- metadata.gz: 2653688852fe8b84876266ffc34a674cc82f038b39958af172c378d80ddabf7e0921a0daaaff11c5d4a7be69ea670faae77a744ef136df41dbd81d421bfff0a5
7
- data.tar.gz: da5199536bf1a4122085fab98ab11b5db08cecad6ef346b19fc17337b1d2c948d9c0f6b3c3e911c89650ab24a19ee9f0d2342b728b97cc80baf8e7d731b5621f
6
+ metadata.gz: 9e8545b0d2035c652ff75d6d661938f8fb2b7a866e2393c2084120672b923d32bd65da35bd6c0a1cf4364e5b81093cbfb485c7a779eefc55ae8451c13ed702b8
7
+ data.tar.gz: 9b1d22263be24c51ef3392b32e17e9d836827b55ee3a4fa7a3b2836519faef09df295951673bb0ca33de6c55173d2d9d67685f78b8b6219d2cc61ccaa96cb301
data/.travis.yml CHANGED
@@ -5,10 +5,12 @@ branches:
5
5
  - master
6
6
  rvm:
7
7
  - 2.3.3
8
- - 2.4.1
8
+ - 2.4.3
9
+ - 2.5.0
10
+ - ruby-head
9
11
 
10
12
  script:
11
- - bundle exec rake style
13
+ - bundle exec rake style:chefstyle
12
14
  - bundle exec rake unit
13
15
  - bundle exec rake yard
14
16
 
data/CHANGELOG.md CHANGED
@@ -1,7 +1,16 @@
1
1
  # Change Log
2
2
 
3
- ## [v2.2.2](https://github.com/chef-partners/chef-provisioning-vsphere/tree/v2.2.2)
3
+ ## [v2.3.0](https://github.com/chef-partners/chef-provisioning-vsphere/tree/v2.3.0)
4
4
 
5
+ [Full Changelog](https://github.com/chef-partners/chef-provisioning-vsphere/compare/v2.2.2...v2.3.0)
6
+
7
+ **Merged pull requests:**
8
+
9
+ - Fix missing\_method deprecation from Cheffish::MergedConfig [\#88](https://github.com/chef-partners/chef-provisioning-vsphere/pull/88) ([josh-barker](https://github.com/josh-barker))
10
+ - Trying to make travis happy [\#87](https://github.com/chef-partners/chef-provisioning-vsphere/pull/87) ([jjasghar](https://github.com/jjasghar))
11
+ - Trying to get back to standards [\#86](https://github.com/chef-partners/chef-provisioning-vsphere/pull/86) ([jjasghar](https://github.com/jjasghar))
12
+
13
+ ## [v2.2.2](https://github.com/chef-partners/chef-provisioning-vsphere/tree/v2.2.2) (2018-06-05)
5
14
  [Full Changelog](https://github.com/chef-partners/chef-provisioning-vsphere/compare/v2.2.1...v2.2.2)
6
15
 
7
16
  **Merged pull requests:**
data/Gemfile CHANGED
@@ -1,5 +1,5 @@
1
1
  # -*- encoding: utf-8 -*-
2
2
  # frozen_string_literal: true
3
3
 
4
- source 'https://rubygems.org'
4
+ source "https://rubygems.org"
5
5
  gemspec
data/Rakefile CHANGED
@@ -1,41 +1,75 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'bundler/gem_tasks'
4
- require 'chef/provisioning/vsphere_driver/version'
5
- require 'rspec/core/rake_task'
6
- require 'rubocop/rake_task'
7
- require 'yard'
3
+ require "bundler/gem_tasks"
4
+ require "chef/provisioning/vsphere_driver/version"
5
+ require "rspec/core/rake_task"
6
+ require "rubocop/rake_task"
7
+ require "yard"
8
8
 
9
- $LOAD_PATH.unshift(File.dirname(__FILE__) + '/lib')
10
-
11
- RuboCop::RakeTask.new(:style) do |task|
12
- task.options << '--display-cop-names'
13
- end
9
+ $LOAD_PATH.unshift(File.dirname(__FILE__) + "/lib")
14
10
 
15
11
  RSpec::Core::RakeTask.new(:unit) do |task|
16
- task.pattern = 'spec/unit_tests/*_spec.rb'
17
- task.rspec_opts = ['--color', '-f documentation']
12
+ task.pattern = "spec/unit_tests/*_spec.rb"
13
+ task.rspec_opts = ["--color", "-f documentation"]
18
14
  end
19
15
 
20
16
  RSpec::Core::RakeTask.new(:integration) do |task|
21
- task.pattern = 'spec/integration_tests/*_spec.rb'
22
- task.rspec_opts = ['--color', '-f documentation', '--out rspec.txt']
17
+ task.pattern = "spec/integration_tests/*_spec.rb"
18
+ task.rspec_opts = ["--color", "-f documentation", "--out rspec.txt"]
23
19
  end
24
20
 
25
21
  begin
26
- require 'github_changelog_generator/task'
22
+ require "github_changelog_generator/task"
27
23
 
28
24
  GitHubChangelogGenerator::RakeTask.new :changelog do |config|
29
25
  config.future_release = ChefProvisioningVsphere::VERSION
30
26
  config.issues = true
31
27
  end
32
28
  rescue LoadError
33
- puts 'github_changelog_generator is not available. gem install github_changelog_generator to generate changelogs'
29
+ puts "github_changelog_generator is not available. gem install github_changelog_generator to generate changelogs"
34
30
  end
35
31
 
36
32
  YARD::Rake::YardocTask.new do |t|
37
- t.files = ['lib/**/*.rb'] # optional
38
- t.stats_options = ['--list-undoc'] # optional
33
+ t.files = ["lib/**/*.rb"] # optional
34
+ t.stats_options = ["--list-undoc"] # optional
39
35
  end
40
36
 
41
- task default: %i(style unit)
37
+ task default: %i{style unit}
38
+
39
+ namespace :style do
40
+ begin
41
+ require "rubocop/rake_task"
42
+
43
+ desc "Run Cookbook Ruby style checks"
44
+ RuboCop::RakeTask.new(:cookstyle) do |t|
45
+ t.requires = ["cookstyle"]
46
+ t.patterns = ["lib/chef-dk/skeletons/code_generator"]
47
+ t.options = ["--display-cop-names"]
48
+ end
49
+ rescue LoadError => e
50
+ puts ">>> Gem load error: #{e}, omitting #{task.name}" unless ENV["CI"]
51
+ end
52
+
53
+ begin
54
+ require "rubocop/rake_task"
55
+
56
+ ignore_dirs = Regexp.union(%w{
57
+ lib/chef-dk/skeletons/code_generator
58
+ spec/unit/fixtures/chef-runner-cookbooks
59
+ spec/unit/fixtures/cookbook_cache
60
+ spec/unit/fixtures/example_cookbook
61
+ spec/unit/fixtures/example_cookbook_metadata_json_only
62
+ spec/unit/fixtures/example_cookbook_no_metadata
63
+ spec/unit/fixtures/local_path_cookbooks
64
+ })
65
+
66
+ desc "Run Chef Ruby style checks"
67
+ RuboCop::RakeTask.new(:chefstyle) do |t|
68
+ t.requires = ["chefstyle"]
69
+ t.patterns = `rubocop --list-target-files`.split("\n").reject { |f| f =~ ignore_dirs }
70
+ t.options = ["--display-cop-names"]
71
+ end
72
+ rescue LoadError => e
73
+ puts ">>> Gem load error: #{e}, omitting #{task.name}" unless ENV["CI"]
74
+ end
75
+ end
@@ -1,39 +1,39 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- $LOAD_PATH.unshift(File.dirname(__FILE__) + '/lib')
4
- require 'chef/provisioning/vsphere_driver/version'
3
+ $LOAD_PATH.unshift(File.dirname(__FILE__) + "/lib")
4
+ require "chef/provisioning/vsphere_driver/version"
5
5
 
6
6
  # rubocop Metrics/ModuleLength
7
7
  Gem::Specification.new do |s|
8
- s.name = 'chef-provisioning-vsphere'
8
+ s.name = "chef-provisioning-vsphere"
9
9
  s.version = ChefProvisioningVsphere::VERSION
10
10
  s.platform = Gem::Platform::RUBY
11
- s.extra_rdoc_files = ['README.md']
12
- s.summary = 'Provisioner for creating vSphere VM instances in Chef Provisioning.'
11
+ s.extra_rdoc_files = ["README.md"]
12
+ s.summary = "Provisioner for creating vSphere VM instances in Chef Provisioning."
13
13
  s.description = s.summary
14
- s.authors = ['CenturyLink Cloud', 'JJ Asghar']
15
- s.email = 'jj@chef.io'
16
- s.homepage = 'https://github.com/chef-partners/chef-provisioning-vsphere'
17
- s.license = 'MIT'
18
- s.bindir = 'bin'
19
- s.executables = %w()
20
- s.require_path = 'lib'
14
+ s.authors = ["CenturyLink Cloud", "JJ Asghar"]
15
+ s.email = "jj@chef.io"
16
+ s.homepage = "https://github.com/chef-partners/chef-provisioning-vsphere"
17
+ s.license = "MIT"
18
+ s.bindir = "bin"
19
+ s.executables = %w{}
20
+ s.require_path = "lib"
21
21
  s.files = `git ls-files -z`.split("\x0")
22
22
  s.test_files = s.files.grep(%r{^(test|spec|features)/})
23
23
 
24
- s.add_dependency 'chef', '>= 12.0'
25
- s.add_dependency 'chef-provisioning', '~> 2.0'
26
- s.add_dependency 'cheffish', '>= 4.0'
27
- s.add_dependency 'rbvmomi', '~> 1.10'
24
+ s.add_dependency "chef", ">= 12.0"
25
+ s.add_dependency "chef-provisioning", "~> 2.0"
26
+ s.add_dependency "cheffish", ">= 4.0"
27
+ s.add_dependency "rbvmomi", "~> 1.10"
28
28
 
29
- s.add_development_dependency 'chefstyle'
30
- s.add_development_dependency 'github_changelog_generator'
31
- s.add_development_dependency 'pry'
32
- s.add_development_dependency 'pry-byebug'
33
- s.add_development_dependency 'pry-stack_explorer'
34
- s.add_development_dependency 'rake'
35
- s.add_development_dependency 'rb-readline'
36
- s.add_development_dependency 'rspec'
37
- s.add_development_dependency 'simplecov'
38
- s.add_development_dependency 'yard'
29
+ s.add_development_dependency "chefstyle"
30
+ s.add_development_dependency "github_changelog_generator"
31
+ s.add_development_dependency "pry"
32
+ s.add_development_dependency "pry-byebug"
33
+ s.add_development_dependency "pry-stack_explorer"
34
+ s.add_development_dependency "rake"
35
+ s.add_development_dependency "rb-readline"
36
+ s.add_development_dependency "rspec"
37
+ s.add_development_dependency "simplecov"
38
+ s.add_development_dependency "yard"
39
39
  end
@@ -1,31 +1,32 @@
1
- require 'chef/provisioning'
2
- require 'chef/provisioning/vsphere_driver'
1
+ # frozen_string_literal: true
2
+ require "chef/provisioning"
3
+ require "chef/provisioning/vsphere_driver"
3
4
 
4
5
  #
5
6
  # This is the main way to connect to vSphere
6
7
  #
7
- with_vsphere_driver host: '172.16.20.2',
8
- insecure: true,
9
- user: 'administrator@vsphere.local',
10
- password: 'PASSWORD'
8
+ with_vsphere_driver host: "172.16.20.2",
9
+ insecure: true,
10
+ user: "administrator@vsphere.local",
11
+ password: "PASSWORD"
11
12
 
12
13
  #
13
14
  # These are the machine_options that you need to declare
14
15
  #
15
- with_machine_options :bootstrap_options => {
16
- num_cpus: 2,
17
- memory_mb: 4096,
18
- datacenter: 'Datacenter',
19
- resource_pool: 'Cluster',
20
- template_folder: 'Linux',
21
- template_name: 'ubuntu16',
22
- :ssh => {
23
- :user => 'admini',
24
- :password => 'PASSWORD',
25
- :paranoid => false,
26
- }
27
- },
28
- :sudo => true
16
+ with_machine_options bootstrap_options: {
17
+ num_cpus: 2,
18
+ memory_mb: 4096,
19
+ datacenter: "Datacenter",
20
+ resource_pool: "Cluster",
21
+ template_folder: "Linux",
22
+ template_name: "ubuntu16",
23
+ ssh: {
24
+ user: "admini",
25
+ password: "PASSWORD",
26
+ paranoid: false,
27
+ },
28
+ },
29
+ sudo: true
29
30
 
30
31
  #
31
32
  # This is where you can declare the machine
@@ -1,42 +1,41 @@
1
- require 'chef/provisioning'
2
- require 'chef/provisioning/vsphere_driver'
3
-
1
+ # frozen_string_literal: true
2
+ require "chef/provisioning"
3
+ require "chef/provisioning/vsphere_driver"
4
4
 
5
5
  #
6
6
  # This is the main way to connect to vSphere
7
7
  #
8
- with_vsphere_driver host: '172.16.20.2',
9
- insecure: true,
10
- user: 'administrator@vsphere.local',
11
- password: 'PASSWORD'
8
+ with_vsphere_driver host: "172.16.20.2",
9
+ insecure: true,
10
+ user: "administrator@vsphere.local",
11
+ password: "PASSWORD"
12
12
 
13
13
  #
14
14
  # These are the machine_options that you need to declare
15
15
  #
16
- win_bootstrap_options = { :bootstrap_options => {
17
- num_cpus: 2,
18
- memory_mb: 8096,
19
- datacenter: 'Datacenter',
20
- resource_pool: 'Cluster',
21
- template_folder: 'Windows',
22
- template_name: 'windows2012R2',
23
- :ssh => {
24
- :user => 'Administrator',
25
- :password => 'P@ssw0rd!!!',
26
- :paranoid => false,
27
- :port => "5985"
28
- }
29
- },
30
- ssh_options: { :keepalive => true, :keepalive_interval => 50, :user_known_hosts_file => '/dev/null' },
31
- ready_timeout: '30'
32
- }
16
+ win_bootstrap_options = { bootstrap_options: {
17
+ num_cpus: 2,
18
+ memory_mb: 8096,
19
+ datacenter: "Datacenter",
20
+ resource_pool: "Cluster",
21
+ template_folder: "Windows",
22
+ template_name: "windows2012R2",
23
+ ssh: {
24
+ user: "Administrator",
25
+ password: "P@ssw0rd!!!",
26
+ paranoid: false,
27
+ port: "5985",
28
+ },
29
+ },
30
+ ssh_options: { keepalive: true, keepalive_interval: 50, user_known_hosts_file: "/dev/null" },
31
+ ready_timeout: "30" }
33
32
 
34
33
  #
35
34
  # WinRM requires a Chef server (not sure why) so you need to declare it here
36
35
  #
37
36
  with_chef_server "https://api.chef.io/organizations/ORG",
38
- :client_name => Chef::Config[:node_name],
39
- :signing_key_filename => Chef::Config[:client_key]
37
+ client_name: Chef::Config[:node_name],
38
+ signing_key_filename: Chef::Config[:client_key]
40
39
 
41
40
  #
42
41
  # This is where you can declare the machine
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'chef/provisioning/vsphere_driver'
3
+ require "chef/provisioning/vsphere_driver"
4
4
 
5
- Chef::Provisioning.register_driver_class('vsphere', ChefProvisioningVsphere::VsphereDriver)
5
+ Chef::Provisioning.register_driver_class("vsphere", ChefProvisioningVsphere::VsphereDriver)
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'chef/provisioning'
4
- require 'chef/provisioning/vsphere_driver/driver'
3
+ require "chef/provisioning"
4
+ require "chef/provisioning/vsphere_driver/driver"
5
5
 
6
6
  # The main Chef class for all the Chef code!
7
7
  class Chef
@@ -43,7 +43,7 @@ module ChefProvisioningVsphere
43
43
  end
44
44
 
45
45
  unless options[:network_name].nil?
46
- deviceAdditions, changes = vsphere_helper.network_device_changes(
46
+ deviceAdditions, changes = vsphere_helper.network_device_changes( # rubocop:disable Naming/VariableName, Lint/UselessAssignment
47
47
  action_handler,
48
48
  vm_template,
49
49
  options
@@ -78,12 +78,12 @@ module ChefProvisioningVsphere
78
78
  elsif vm_template.config.template && !host.nil?
79
79
  rspec.pool = host.parent.resourcePool # assign to the "invisible" pool root
80
80
  elsif vm_template.config.template
81
- raise 'either :host or :resource_pool must be specified when cloning from a VM Template'
81
+ raise "either :host or :resource_pool must be specified when cloning from a VM Template"
82
82
  end
83
83
 
84
84
  if options[:use_linked_clone]
85
85
  if vm_template.config.template
86
- Chef::Log.warn('Using a VM Template, ignoring use_linked_clone.')
86
+ Chef::Log.warn("Using a VM Template, ignoring use_linked_clone.")
87
87
  else
88
88
  vsphere_helper.create_delta_disk(vm_template)
89
89
  rspec.diskMoveType = :moveChildMostDiskBacking
@@ -105,16 +105,16 @@ module ChefProvisioningVsphere
105
105
  def customization_options_from(vm_template, vm_name, options)
106
106
  if options.key?(:customization_spec)
107
107
  if options[:customization_spec].is_a?(Hash) ||
108
- options[:customization_spec].is_a?(Cheffish::MergedConfig)
108
+ options[:customization_spec].is_a?(Cheffish::MergedConfig)
109
109
  cust_options = options[:customization_spec]
110
110
  ip_settings = cust_options[:ipsettings]
111
111
  cust_domain = cust_options[:domain]
112
112
 
113
- raise ArgumentError, 'domain is required' unless cust_domain
113
+ raise ArgumentError, "domain is required" unless cust_domain
114
114
  cust_ip_settings = nil
115
115
  if ip_settings && ip_settings.key?(:ip)
116
116
  unless cust_options[:ipsettings].key?(:subnetMask)
117
- raise ArgumentError, 'subnetMask is required for static ip'
117
+ raise ArgumentError, "subnetMask is required for static ip"
118
118
  end
119
119
  cust_ip_settings = RbVmomi::VIM::CustomizationIPSettings.new(
120
120
  ip_settings
@@ -145,7 +145,7 @@ module ChefProvisioningVsphere
145
145
  cust_hwclockutc = cust_options[:hw_clock_utc]
146
146
  cust_timezone = cust_options[:time_zone]
147
147
 
148
- cust_prep = if vm_template.config.guestId.start_with?('win')
148
+ cust_prep = if vm_template.config.guestId.start_with?("win")
149
149
  windows_prep_for(options, vm_name)
150
150
  else
151
151
  RbVmomi::VIM::CustomizationLinuxPrep.new(
@@ -158,7 +158,7 @@ module ChefProvisioningVsphere
158
158
  cust_adapter_mapping = [
159
159
  RbVmomi::VIM::CustomizationAdapterMapping.new(
160
160
  adapter: cust_ip_settings
161
- )
161
+ ),
162
162
  ]
163
163
  RbVmomi::VIM::CustomizationSpec.new(
164
164
  identity: cust_prep,
@@ -179,7 +179,7 @@ module ChefProvisioningVsphere
179
179
  hostname = options[:hostname] || vm_name
180
180
  test = /^([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]*[a-zA-Z0-9])$/
181
181
  unless hostname.match?(test)
182
- raise 'Only letters, numbers or hyphens in hostnames allowed'
182
+ raise "Only letters, numbers or hyphens in hostnames allowed"
183
183
  end
184
184
  RbVmomi::VIM::CustomizationFixedName.new(name: hostname)
185
185
  end
@@ -200,10 +200,10 @@ module ChefProvisioningVsphere
200
200
  plainText: true,
201
201
  value: options[:ssh][:password]
202
202
  )
203
- if cust_options.key?(:domain) && (cust_options[:domain] != 'local')
203
+ if cust_options.key?(:domain) && (cust_options[:domain] != "local")
204
204
  cust_domain_password = RbVmomi::VIM::CustomizationPassword(
205
205
  plainText: true,
206
- value: ENV['domainAdminPassword'] || cust_options[:domainAdminPassword]
206
+ value: ENV["domainAdminPassword"] || cust_options[:domainAdminPassword]
207
207
  )
208
208
  cust_id = RbVmomi::VIM::CustomizationIdentification.new(
209
209
  joinDomain: cust_options[:domain],
@@ -214,7 +214,7 @@ module ChefProvisioningVsphere
214
214
  with user: #{cust_options[:domainAdmin]}"
215
215
  else
216
216
  cust_id = RbVmomi::VIM::CustomizationIdentification.new(
217
- joinWorkgroup: 'WORKGROUP'
217
+ joinWorkgroup: "WORKGROUP"
218
218
  )
219
219
  end
220
220
  cust_gui_unattended = RbVmomi::VIM::CustomizationGuiUnattended.new(