knife-rackspace 1.0.1 → 2.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -17,7 +17,7 @@
17
17
  # limitations under the License.
18
18
  #
19
19
 
20
- require "chef/knife/rackspace_base"
20
+ require_relative "rackspace_base"
21
21
 
22
22
  # These two are needed for the '--purge' deletion case
23
23
  require "chef/node"
@@ -32,16 +32,16 @@ class Chef
32
32
  banner "knife rackspace server delete SERVER_ID [SERVER_ID] (options)"
33
33
 
34
34
  option :purge,
35
- :short => "-P",
36
- :long => "--purge",
37
- :boolean => true,
38
- :default => false,
39
- :description => "Destroy corresponding node and client on the Chef Server, in addition to destroying the Rackspace node itself. Assumes node and client have the same name as the server (if not, add the '--node-name' option)."
35
+ short: "-P",
36
+ long: "--purge",
37
+ boolean: true,
38
+ default: false,
39
+ description: "Destroy corresponding node and client on the Chef Server, in addition to destroying the Rackspace node itself. Assumes node and client have the same name as the server (if not, add the '--node-name' option)."
40
40
 
41
41
  option :chef_node_name,
42
- :short => "-N NAME",
43
- :long => "--node-name NAME",
44
- :description => "The name of the node and client to delete, if it differs from the server name. Only has meaning when used with the '--purge' option."
42
+ short: "-N NAME",
43
+ long: "--node-name NAME",
44
+ description: "The name of the node and client to delete, if it differs from the server name. Only has meaning when used with the '--purge' option."
45
45
 
46
46
  # Extracted from Chef::Knife.delete_object, because it has a
47
47
  # confirmation step built in... By specifying the '--purge'
@@ -49,13 +49,11 @@ class Chef
49
49
  # the user is already making their intent known. It is not
50
50
  # necessary to make them confirm two more times.
51
51
  def destroy_item(klass, name, type_name)
52
- begin
53
- object = klass.load(name)
54
- object.destroy
55
- ui.warn("Deleted #{type_name} #{name}")
56
- rescue Net::HTTPServerException
57
- ui.warn("Could not find a #{type_name} named #{name} to delete!")
58
- end
52
+ object = klass.load(name)
53
+ object.destroy
54
+ ui.warn("Deleted #{type_name} #{name}")
55
+ rescue Net::HTTPServerException
56
+ ui.warn("Could not find a #{type_name} named #{name} to delete!")
59
57
  end
60
58
 
61
59
  def run
@@ -84,7 +82,7 @@ class Chef
84
82
  destroy_item(Chef::Node, thing_to_delete, "node")
85
83
  destroy_item(Chef::ApiClient, thing_to_delete, "client")
86
84
  else
87
- #v2 nodes may be named automatically
85
+ # v2 nodes may be named automatically
88
86
  thing_to_delete = config[:chef_node_name] || server.name
89
87
  destroy_item(Chef::Node, thing_to_delete, "node")
90
88
  destroy_item(Chef::ApiClient, thing_to_delete, "client")
@@ -16,7 +16,7 @@
16
16
  # limitations under the License.
17
17
  #
18
18
 
19
- require "chef/knife/rackspace_base"
19
+ require_relative "rackspace_base"
20
20
 
21
21
  class Chef
22
22
  class Knife
@@ -39,7 +39,7 @@ class Chef
39
39
  if version_one?
40
40
  network_list = %w{public private}
41
41
  else
42
- network_list = connection.networks.sort_by(&:label).collect { |t| t.label }
42
+ network_list = connection.networks.sort_by(&:label).collect(&:label)
43
43
  end
44
44
  server_list.insert(2, network_list.collect { |n| ui.color("#{n.capitalize} IP", :bold) }).flatten!
45
45
  num_columns_across = server_list.length
@@ -48,8 +48,8 @@ class Chef
48
48
  server_list << server.id.to_s
49
49
  server_list << server.name
50
50
  server_list += network_list.collect { |n| ip_address(server, n) }
51
- server_list << (server.flavor_id == nil ? "" : server.flavor_id.to_s)
52
- server_list << (server.image_id == nil ? "" : server.image_id.to_s)
51
+ server_list << (server.flavor_id.nil? ? "" : server.flavor_id.to_s)
52
+ server_list << (server.image_id.nil? ? "" : server.image_id.to_s)
53
53
  server_list << begin
54
54
  case server.state.downcase
55
55
  when "deleted", "suspended"
@@ -1,6 +1,6 @@
1
1
  module Knife
2
2
  module Rackspace
3
- VERSION = "1.0.1"
3
+ VERSION = "2.0.2".freeze
4
4
  MAJOR, MINOR, TINY = VERSION.split(".")
5
5
  end
6
6
  end
@@ -3,8 +3,8 @@ require "vcr"
3
3
  require "ansi/code"
4
4
  require "ansi/diff"
5
5
 
6
- Chef::Config[:knife][:rackspace_api_username] = "#{ENV['OS_USERNAME']}"
7
- Chef::Config[:knife][:rackspace_api_key] = "#{ENV['OS_PASSWORD']}"
6
+ Chef::Config[:knife][:rackspace_api_username] = "#{ENV["OS_USERNAME"]}"
7
+ Chef::Config[:knife][:rackspace_api_key] = "#{ENV["OS_PASSWORD"]}"
8
8
  Chef::Config[:knife][:ssl_verify_peer] = false
9
9
  # Chef::Config[:knife][:rackspace_version] = "#{ENV['RS_VERSION']}"
10
10
 
@@ -45,9 +45,9 @@ VCR.configure do |c|
45
45
  c.default_cassette_options = {
46
46
  # :record => :none,
47
47
  # Ignores cache busting parameters.
48
- :match_requests_on => [:host, :path],
48
+ match_requests_on: %i{host path},
49
49
  }
50
- c.default_cassette_options.merge!({ :record => :all }) if ENV["INTEGRATION_TESTS"] == "live"
50
+ c.default_cassette_options.merge!({ record: :all }) if ENV["INTEGRATION_TESTS"] == "live"
51
51
  end
52
52
 
53
53
  def filter_headers(interaction, pattern, placeholder)
@@ -104,7 +104,7 @@ def capture_instance_data(stdout, labels = {})
104
104
  result
105
105
  end
106
106
 
107
- # Ideally this belongs in knife-dsl, but it causes a scoping conflict with knife.rb.
107
+ # Ideally this belongs in knife-dsl, but it causes a scoping conflict with config.rb (knife.rb).
108
108
  # See https://github.com/chef-workflow/knife-dsl/issues/2
109
109
  def knife_capture(command, args = [], input = nil)
110
110
  null = Gem.win_platform? ? File.open("NUL:", "r") : File.open("/dev/null", "r")
@@ -124,7 +124,7 @@ def knife_capture(command, args = [], input = nil)
124
124
  $VERBOSE = warn
125
125
 
126
126
  status = Chef::Knife::DSL::Support.run_knife(command, args)
127
- return $stdout.string, $stderr.string, status
127
+ [$stdout.string, $stderr.string, status]
128
128
  ensure
129
129
  warn = $VERBOSE
130
130
  $VERBOSE = nil
@@ -18,7 +18,7 @@ describe "auth_endpoint" do
18
18
  expect(tester.auth_endpoint).to eq(test_url)
19
19
  end
20
20
 
21
- [:dfw, :ord, :syd].each do |region|
21
+ %i{dfw ord syd}.each do |region|
22
22
  it "should pick the US endpoint if the region is #{region}" do
23
23
  tester = RackspaceBaseTester.new
24
24
  Chef::Config[:knife][:rackspace_auth_url] = nil
@@ -38,7 +38,7 @@ describe "auth_endpoint" do
38
38
  end
39
39
 
40
40
  describe "locate_config_value" do
41
- it 'with cli options' do
41
+ it "with cli options" do
42
42
  # CLI
43
43
  tester = RackspaceBaseTester.new
44
44
  tester.parse_options([ "--rackspace-api-key", "12345" ])
@@ -50,7 +50,7 @@ describe "locate_config_value" do
50
50
  expect(tester.locate_config_value(:rackspace_api_key)).to eq("12345")
51
51
  end
52
52
 
53
- it 'without cli options' do
53
+ it "without cli options" do
54
54
  # CLI
55
55
  tester = RackspaceBaseTester.new
56
56
  tester.parse_options([])
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: knife-rackspace
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 2.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adam Jacob
@@ -12,7 +12,7 @@ authors:
12
12
  autorequire:
13
13
  bindir: bin
14
14
  cert_chain: []
15
- date: 2016-12-14 00:00:00.000000000 Z
15
+ date: 2019-12-30 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: knife-windows
@@ -48,14 +48,14 @@ dependencies:
48
48
  requirements:
49
49
  - - ">="
50
50
  - !ruby/object:Gem::Version
51
- version: '12.0'
51
+ version: '13.0'
52
52
  type: :runtime
53
53
  prerelease: false
54
54
  version_requirements: !ruby/object:Gem::Requirement
55
55
  requirements:
56
56
  - - ">="
57
57
  - !ruby/object:Gem::Version
58
- version: '12.0'
58
+ version: '13.0'
59
59
  description: Rackspace Support for Chef's Knife Command
60
60
  email:
61
61
  - adam@chef.io
@@ -64,20 +64,9 @@ email:
64
64
  - jj@chef.io
65
65
  executables: []
66
66
  extensions: []
67
- extra_rdoc_files:
68
- - README.md
69
- - LICENSE
67
+ extra_rdoc_files: []
70
68
  files:
71
- - ".chef/knife.rb"
72
- - ".github/ISSUE_TEMPLATE.md"
73
- - ".gitignore"
74
- - ".travis.yml"
75
- - CHANGELOG.md
76
- - Gemfile
77
69
  - LICENSE
78
- - README.md
79
- - Rakefile
80
- - knife-rackspace.gemspec
81
70
  - lib/chef/knife/rackspace_base.rb
82
71
  - lib/chef/knife/rackspace_flavor_list.rb
83
72
  - lib/chef/knife/rackspace_image_list.rb
@@ -97,7 +86,8 @@ files:
97
86
  - spec/spec_helper.rb
98
87
  - spec/unit/rackspace_base_spec.rb
99
88
  homepage: https://github.com/chef/knife-rackspace
100
- licenses: []
89
+ licenses:
90
+ - Apache-2.0
101
91
  metadata: {}
102
92
  post_install_message:
103
93
  rdoc_options: []
@@ -107,16 +97,23 @@ required_ruby_version: !ruby/object:Gem::Requirement
107
97
  requirements:
108
98
  - - ">="
109
99
  - !ruby/object:Gem::Version
110
- version: 2.2.2
100
+ version: '2.3'
111
101
  required_rubygems_version: !ruby/object:Gem::Requirement
112
102
  requirements:
113
103
  - - ">="
114
104
  - !ruby/object:Gem::Version
115
105
  version: '0'
116
106
  requirements: []
117
- rubyforge_project:
118
- rubygems_version: 2.4.8
107
+ rubygems_version: 3.0.3
119
108
  signing_key:
120
109
  specification_version: 4
121
110
  summary: Rackspace Support for Chef's Knife Command
122
- test_files: []
111
+ test_files:
112
+ - spec/cassettes/v1/should_list_images.yml
113
+ - spec/cassettes/v1/should_list_server_flavors.yml
114
+ - spec/cassettes/v2/should_list_images.yml
115
+ - spec/cassettes/v2/should_list_server_flavors.yml
116
+ - spec/integration/integration_spec.rb
117
+ - spec/integration_spec_helper.rb
118
+ - spec/spec_helper.rb
119
+ - spec/unit/rackspace_base_spec.rb
data/.chef/knife.rb DELETED
@@ -1,18 +0,0 @@
1
- current_dir = File.dirname(__FILE__)
2
- log_level :info
3
- log_location STDOUT
4
- #node_name "knife-rackspace"
5
- #client_key "#{current_dir}/knife-rackspace.pem"
6
- #validation_client_name "knife-rackspace-validator"
7
- #validation_key "#{current_dir}/knife-rackspace-validator.pem"
8
- #chef_server_url "https://api.opscode.com/organizations/knife-rackspace"
9
- #cache_type 'basicfile'
10
- #cache_options( :path => "#{ENV['home']}/.chef/checksums" )
11
- #cookbook_path ["#{current_dir}/../cookbooks"]
12
-
13
- knife[:rackspace_api_username] = "#{ENV['OS_USERNAME']}"
14
- knife[:rackspace_api_key] = "#{ENV['OS_PASSWORD']}"
15
-
16
- #https_proxy 'https://localhost:8888'
17
- #knife[:ssl_verify_peer] = false
18
-
@@ -1,21 +0,0 @@
1
- # Version:
2
-
3
- [Version of the project installed]
4
-
5
- # Environment: [Details about the environment such as the Operating System, cookbook details, etc...]
6
-
7
- # Scenario:
8
-
9
- [What you are trying to achieve and you can't?]
10
-
11
- # Steps to Reproduce:
12
-
13
- [If you are filing an issue what are the things we need to do in order to repro your problem?]
14
-
15
- # Expected Result:
16
-
17
- [What are you expecting to happen as the consequence of above reproduction steps?]
18
-
19
- # Actual Result:
20
-
21
- [What actually happens after the reproduction steps?]
data/.gitignore DELETED
@@ -1,36 +0,0 @@
1
- .rake_tasks~
2
- tags
3
- coverage
4
- rdoc
5
- pkg
6
- test/tmp
7
- test/version_tmp
8
- tmp
9
- pkg
10
- *.gem
11
- *.rbc
12
- lib/bundler/man
13
- spec/reports
14
- .config
15
- InstalledFiles
16
- .bundle
17
- .rackspace_cloud_credentials*
18
- *.lock
19
-
20
- # YARD artifacts
21
- .yardoc
22
- _yardoc
23
- doc/
24
-
25
- .DS_Store
26
- Icon?
27
-
28
- # Thumbnails
29
- ._*
30
-
31
- # Files that might appear on external disk
32
- .Spotlight-V100
33
- .Trashes
34
-
35
- *.swp
36
- *.swo
data/.travis.yml DELETED
@@ -1,47 +0,0 @@
1
- language: ruby
2
- cache: bundler
3
- sudo: false
4
- rvm:
5
- - 2.2.5
6
- - 2.3.1
7
- env:
8
- global:
9
- - excon_debug: true
10
- - secure: |-
11
- eEsikE/p2yz7/cFvCN/NOoljxBqjzsTWnKC7iZ+fEGGsyhKVJgWn4AasBusZ
12
- mhtQcOqwakRulzVc+EZN4pqWHgaMC7SnSwhqRU5u1E+BPI4iWNsu+7rjiXhE
13
- cJK1vE8YodgsgRDQ6evZVQLkwJpRk0qq2tM2LDqpzvy2MeQJIGc=
14
- - secure: |-
15
- V3ohIIF3I8lD05zTUs2nu+CcIzBYcvt1c1euRJ+SPcAH493b4cPquw1NZNFy
16
- WDIW+1qDQi1DXr8C3Yq8bL4+pY66SukHtxyLhx0V26lGUvI8naq3IqageBQK
17
- pkb2zZwVYO0a5mLEKOI/7omExBVHDxxX9Bw45vCHLKId3Wt21HE=
18
- - secure: |-
19
- OyKQU1muVBijz2/EkLUgBWbwPKG2UqRhIfpB1ZFkfdQ/06+Vaf82ZEQk3DvY
20
- 2lYFrzvSN1yWrKTMU3XES/dPlVlH87LDOrRhNhgW/NeHhC5BzdwrtvBm08RN
21
- 64ACuFG8fch9zIbx2VTkyLV8xsFXPPSaKMbEXrnikLwqnl5M8PQ=
22
- - secure: |-
23
- DoDVG0HwFg2a7Fj72tlxb8KJto+cBEh7J9YQZ35hK2cmeTsBAcZ4oSOUeAFg
24
- s2MvBhX0man0zjYPStbL1vcpuS1Ecea3kGzefG0lYhHAzvK7wqqRqhKNFsnd
25
- FPEVgZrcj3/Lc7mlkbigZouDM7BJLQbMGOv/KOS6f3nYzIhkOfE=
26
- - secure: |-
27
- SB4aoB5BCqqSFMpxJvN031tikc7VzXGX6PaOIngu5h3M9k3Qmkuvel8oQISb
28
- fhcbsmuA0EKlaCvjQsgXFoUvUE6UnPCc7h2816fEAEz7FrRF1Q1mnbZ2V/kG
29
- PtPYcPl4ZH4VxwAD+6kTtbl1aCTP8nKXTFXlKlrPAawpS7ef0B8=
30
- - secure: |-
31
- J01xNjFaqlwzin59fpvgKkp49p5VI128cFvM3pxvlErPLnjWE9kJ4NKzzznv
32
- tVc12zVat/twxepvjSzg88b0q4Ks6P0Ovy0LeQCFUkva/jiBQuGukByR3joU
33
- xuAFiCssBoaZEEKlN69n/zhihFxG/0z8Tn4h9pgAkSAyAq8UZJ0=
34
- - secure: |-
35
- W7NIurlDI/LtO27N5Yv9i2i/TLvwSL6L5bF0yJMtPNsL21xbcqBkcFY+0PEU
36
- 2jIzA6Ib861UACb9Xh45tXmY/zuUHQ/otuIdAwocawulxBjrTuNUDo58ZVEv
37
- GzvTdFIaOWczTTvBcaNy9msenXiRBQTWriMFR0uPKIH/mYGF3Ew=
38
- - secure: |-
39
- RQDTTLjob/9p+9XpcpYo4VaQSVvVbbHtUcpVyTXcnHwMq3WJzXXBoj/9iFxA
40
- Uupx9IhP0gZhX6kzcm5BG+oKTYAxTQkf2tRCRkVMBFCJKreER1SuSDVvljdV
41
- KLMfTbC5qwXox78PtD23BjO5k8hCJCSHfs0XuQ5y7k1mMFjM4ok=
42
- deploy:
43
- provider: rubygems
44
- api_key:
45
- secure: YeHeF7cuLuN3lHJQNQ4jpgfhaHGuB861cF6dzoyGPzAi/PO3wmTZfDNG27iI3zCe3CPviDSPiK4v14SQA1Xq3UtvSmeE+zcX/PxYsjNp7EQPn8J6fq2DfjmhYU5ECXnojbTkoh2HIM29YXBjxS8VlSTFDHYx0oV6uMZFgrzSLrI=
46
- on:
47
- tags: true
data/CHANGELOG.md DELETED
@@ -1,109 +0,0 @@
1
- ## v1.0.1
2
- * Fix Server List exception (#131)
3
- * Fix bug preferring knife over CLI configurations items (#128)
4
-
5
- ## v1.0.0
6
- * Use fog/rackspace instead of fog gem
7
- * Require Ruby 2.2.2 / Chef 12 and general cleanup
8
- * Spec updates to avoid deprecation warnings
9
- * Chefstyle fixes
10
- * Modified server list - #118
11
-
12
- ## v0.11.1
13
- * Remove unused, and unsupported/ancient knife-dsl requirement
14
- * Take it all the way to 11 (Chef 11.x) and greater
15
-
16
- ## v0.11.0
17
- * Add -B (boot volume ID) to `knife rackspace server create` - #91
18
-
19
- ## v0.10.1
20
- * Support new chef-vault boostrap flags (--bootstrap-vault-file, -bootstrap-vault-json, and --bootstrap-vault-item)
21
-
22
- ## v0.10.0
23
- * KNIFE-498 knife rackspace uses direct TCP connection on port 22 to verify SSHD
24
- * Update Windows bootstrapping instructions in the README
25
- * Fix warning for deprecated :keypair for :key_name
26
-
27
- ## v0.9.3
28
- * KNIFE-497 Create server command does not honor timeout parameter
29
-
30
- ## v0.9.2
31
- * KNIFE-480 Add support for user-data
32
- * --secret-file support for bootstrap
33
-
34
- ## v0.9.1
35
- * KNIFE-460 Remove extraneous flavor reloads
36
- * KNIFE-459 Add support for config-drive
37
- * KNIFE-440 fix two minor typos in the ui.error message
38
- * use {public_ip_address}.xip.io instead of {public_ip_address}.rs-cloud.xip.io
39
-
40
- ## v0.9.0
41
- * KNIFE-398 support secret/secret_file in knife.rb
42
- * KNIFE-420 Add --ssh-keypair for using ssh keys already registered with nova.
43
- * KNIFE-437 remove default region and make region required
44
- * replace static.cloud-ips with xip (cloud-ips was deprecated https://community.rackspace.com/general/f/34/t/623)
45
- * updated Fog dependency to 1.16
46
-
47
- ## v0.8.4
48
- * KNIFE-408 TypeError: wrong argument type Symbol (expected Module)
49
-
50
- ## v0.8.2
51
- * KNIFE-335 Wait for RackConnect and/or Service Level automation before bootstrapping
52
- * KNIFE-366 Allow arbitrary bootstrap networks
53
- * KNIFE-399 update knife rackspace to support string based flavor ids
54
- * Fixing issue with bootstrapping Windows server
55
- * Fog 1.16 updates
56
-
57
- ## v0.8.0
58
- * KNIFE-68 enable ability to modify ssh port number
59
- * KNIFE-180 include option to pass :disk_config option to fog for new node bootstrap
60
- * KNIFE-312 updated to reflect new configuration options in Fog 1.10.1
61
- * KNIFE-314 provisioning First Gen Cloud Server is broken
62
- * KNIFE-315 fixed DEPRECATION warnings related to use of old rackpace_auth_url and removed rackspace_endpoint
63
-
64
- ## v0.7.0
65
- * KNIFE_RACKSPACE-32 Ensure hint file is created to improve Ohai detection.
66
- * KNIFE-181 correct mixed use of 'rackspace_auth_url' and 'rackspace_api_auth_url'. Only 'rackspace_auth_url' is correct.
67
- * KNIFE-182 default to Rackspace Open Cloud (v2)
68
- * KNIFE-267 Rackspace server create with networks
69
- * KNIFE-271 Enable winrm authentication on knife-rackspace
70
- * KNIFE-281 pass https_proxy and http_proxy setting onto fog; added ssl_verify_peer setting to disable certificate validation
71
- * KNIFE-282 Add the ability to inject files on server creation
72
- * KNIFE-289 Add Integration Tests
73
-
74
- * KNOWN ISSUES: KNIFE-296 knife-windows overrides -x option with winrm-user
75
-
76
- ## v0.6.2
77
- * bump release to fix permission issues inside the gem
78
-
79
- ## v0.6.0
80
- * KNIFE_RACKSPACE-39 support for Rackspace Open Cloud (v2)
81
- * server list puts the name in second column
82
- * flavor list supports VCPUs for v2
83
- * server delete for v2 will attempt the name when purging since we set the name
84
- * docs updated to reflect all of the regions and APIs supported
85
-
86
- ## v0.5.16
87
- * KNIFE_RACKSPACE-36 Changed to code to use IP address for bootstrapping
88
- * KNIFE_RACKSPACE-38 Support the -P --purge option
89
- * Refactored to use msg_pair method like other knife plugins with eye on eventual base class.
90
- * KNIFE_RACKSPACE-29 Support private network to connect to for bootstrap
91
- * KNIFE_RACKSPACE-40 Support for disabling host key checking
92
- * Added the 'unknown' state to `rackspace server list`, appeared transitory
93
-
94
- ## v0.5.14
95
- * KNIFE_RACKSPACE-25 version bump to match knife-ec2's dependencies
96
- * KNIFE_RACKSPACE-33 chef-full is new default
97
- * updated authors
98
- * Fix of small typo "backspace" > "rackspace".
99
- * KNIFE_RACKSPACE-31 chef dependency needed, add explicit gem deps
100
- * KNIFE_RACKSPACE-7 switch to uneven_columns_across for prettier output
101
- * updated for rackspace_api_username and the correct current image number for Ubuntu 10.04 LTS
102
- * KNIFE-RACKSPACE-26 fog doesn't provide cores enumeration anymore
103
- * updated copyright and removed trailing comma
104
- * KNIFE_RACKSPACE-30 Make use of --json-attributes option for knife
105
- bootstrap.
106
-
107
- ## v0.5.12
108
- * remove dependency on net-ssh and net-ssh-multi..neither is access directly in plugin
109
- * KNIFE_RACKSPACE-18: Increase net-ssh-multi dependecy to 1.1.0