knife-linode 0.3.2 → 0.3.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,7 +1,7 @@
1
- # Author:: Adam Jacob (<adam@opscode.com>)
2
- # Author:: Seth Chisamore (<schisamo@opscode.com>)
3
- # Author:: Lamont Granquist (<lamont@opscode.com>)
4
- # Copyright:: Copyright (c) 2010-2011 Opscode, Inc.
1
+ # Author:: Adam Jacob (<adam@chef.io>)
2
+ # Author:: Seth Chisamore (<schisamo@chef.io>)
3
+ # Author:: Lamont Granquist (<lamont@chef.io>)
4
+ # Copyright:: Copyright (c) 2010-2016 Chef Software, Inc.
5
5
  # License:: Apache License, Version 2.0
6
6
  #
7
7
  # Licensed under the Apache License, Version 2.0 (the "License");
@@ -17,11 +17,11 @@
17
17
  # limitations under the License.
18
18
  #
19
19
 
20
- require 'chef/knife/linode_base'
20
+ require "chef/knife/linode_base"
21
21
 
22
22
  # These two are needed for the '--purge' deletion case
23
- require 'chef/node'
24
- require 'chef/api_client'
23
+ require "chef/node"
24
+ require "chef/api_client"
25
25
 
26
26
  class Chef
27
27
  class Knife
@@ -51,17 +51,14 @@ class Chef
51
51
  # the user is already making their intent known. It is not
52
52
  # necessary to make them confirm two more times.
53
53
  def destroy_item(klass, name, type_name)
54
- begin
55
- object = klass.load(name)
56
- object.destroy
57
- ui.warn("Deleted #{type_name} #{name}")
58
- rescue Net::HTTPServerException
59
- ui.warn("Could not find a #{type_name} named #{name} to delete!")
60
- end
54
+ object = klass.load(name)
55
+ object.destroy
56
+ ui.warn("Deleted #{type_name} #{name}")
57
+ rescue Net::HTTPServerException
58
+ ui.warn("Could not find a #{type_name} named #{name} to delete!")
61
59
  end
62
60
 
63
61
  def run
64
-
65
62
  validate!
66
63
 
67
64
  @name_args.each do |linode_id|
@@ -101,7 +98,6 @@ class Chef
101
98
  end
102
99
 
103
100
  end
104
-
105
101
  end
106
102
  end
107
103
  end
@@ -1,8 +1,8 @@
1
1
 
2
- # Author:: Adam Jacob (<adam@opscode.com>)
3
- # Author:: Seth Chisamore (<schisamo@opscode.com>)
4
- # Author:: Lamont Granquist (<lamont@opscode.com>)
5
- # Copyright:: Copyright (c) 2010-2011 Opscode, Inc.
2
+ # Author:: Adam Jacob (<adam@chef.io>)
3
+ # Author:: Seth Chisamore (<schisamo@chef.io>)
4
+ # Author:: Lamont Granquist (<lamont@chef.io>)
5
+ # Copyright:: Copyright (c) 2010-2016 Chef Software, Inc.
6
6
  # License:: Apache License, Version 2.0
7
7
  #
8
8
  # Licensed under the Apache License, Version 2.0 (the "License");
@@ -18,7 +18,7 @@
18
18
  # limitations under the License.
19
19
  #
20
20
 
21
- require 'chef/knife/linode_base'
21
+ require "chef/knife/linode_base"
22
22
 
23
23
  class Chef
24
24
  class Knife
@@ -29,20 +29,19 @@ class Chef
29
29
  banner "knife linode server list (options)"
30
30
 
31
31
  def run
32
-
33
32
  $stdout.sync = true
34
33
 
35
34
  validate!
36
35
 
37
36
  server_list = [
38
- ui.color('Linode ID', :bold),
39
- ui.color('Name', :bold),
40
- ui.color('IPs', :bold),
41
- ui.color('Status', :bold),
42
- ui.color('Backups', :bold),
43
- ui.color('Datacenter', :bold),
37
+ ui.color("Linode ID", :bold),
38
+ ui.color("Name", :bold),
39
+ ui.color("IPs", :bold),
40
+ ui.color("Status", :bold),
41
+ ui.color("Backups", :bold),
42
+ ui.color("Datacenter", :bold),
44
43
  ]
45
-
44
+
46
45
  dc_location = {}
47
46
 
48
47
  connection.data_centers.map { |dc| dc_location[dc.id] = dc.location }
@@ -52,7 +51,7 @@ class Chef
52
51
  server_list << server.name
53
52
  server_list << server.ips.map { |x| x.ip }.join(",")
54
53
  server_list << status_to_ui(server.status)
55
- server_list << case connection.linode_list(server.id).body['DATA'][0]['BACKUPSENABLED']
54
+ server_list << case connection.linode_list(server.id).body["DATA"][0]["BACKUPSENABLED"]
56
55
  when 0
57
56
  ui.color("No", :red)
58
57
  when 1
@@ -60,11 +59,10 @@ class Chef
60
59
  else
61
60
  ui.color("UNKNOWN", :yellow)
62
61
  end
63
- server_list << dc_location[connection.linode_list(server.id).body['DATA'][0]['DATACENTERID']]
62
+ server_list << dc_location[connection.linode_list(server.id).body["DATA"][0]["DATACENTERID"]]
64
63
  end
65
64
 
66
65
  puts ui.list(server_list, :columns_across, 6)
67
-
68
66
  end
69
67
  end
70
68
  end
@@ -1,7 +1,7 @@
1
- # Author:: Adam Jacob (<adam@opscode.com>)
2
- # Author:: Seth Chisamore (<schisamo@opscode.com>)
3
- # Author:: Lamont Granquist (<lamont@opscode.com>)
4
- # Copyright:: Copyright (c) 2010-2011 Opscode, Inc.
1
+ # Author:: Adam Jacob (<adam@chef.io>)
2
+ # Author:: Seth Chisamore (<schisamo@chef.io>)
3
+ # Author:: Lamont Granquist (<lamont@chef.io>)
4
+ # Copyright:: Copyright (c) 2010-2016 Chef Software, Inc.
5
5
  # License:: Apache License, Version 2.0
6
6
  #
7
7
  # Licensed under the Apache License, Version 2.0 (the "License");
@@ -17,8 +17,8 @@
17
17
  # limitations under the License.
18
18
  #
19
19
 
20
- require 'chef/knife/linode_base'
21
-
20
+ require "chef/knife/linode_base"
21
+
22
22
  class Chef
23
23
  class Knife
24
24
  class LinodeServerReboot < Chef::Knife
@@ -28,7 +28,6 @@ class Chef
28
28
  banner "knife linode server reboot LINODE_ID (options)"
29
29
 
30
30
  def run
31
-
32
31
  validate!
33
32
 
34
33
  @name_args.each do |linode_id|
@@ -49,10 +48,9 @@ class Chef
49
48
  ui.warn("Rebooted server #{linode_id}")
50
49
  rescue Fog::Compute::Linode::NotFound
51
50
  ui.error("Could not locate server '#{linode_id}'.")
52
- end
51
+ end
53
52
 
54
53
  end
55
-
56
54
  end
57
55
  end
58
56
  end
@@ -1,8 +1,8 @@
1
1
 
2
- # Author:: Adam Jacob (<adam@opscode.com>)
3
- # Author:: Seth Chisamore (<schisamo@opscode.com>)
4
- # Author:: Lamont Granquist (<lamont@opscode.com>)
5
- # Copyright:: Copyright (c) 2010-2011 Opscode, Inc.
2
+ # Author:: Adam Jacob (<adam@chef.io>)
3
+ # Author:: Seth Chisamore (<schisamo@chef.io>)
4
+ # Author:: Lamont Granquist (<lamont@chef.io>)
5
+ # Copyright:: Copyright (c) 2010-2016 Chef Software, Inc.
6
6
  # License:: Apache License, Version 2.0
7
7
  #
8
8
  # Licensed under the Apache License, Version 2.0 (the "License");
@@ -18,7 +18,7 @@
18
18
  # limitations under the License.
19
19
  #
20
20
 
21
- require 'chef/knife/linode_base'
21
+ require "chef/knife/linode_base"
22
22
 
23
23
  class Chef
24
24
  class Knife
@@ -29,7 +29,6 @@ class Chef
29
29
  banner "knife linode stackscript list (options)"
30
30
 
31
31
  def run
32
-
33
32
  validate!
34
33
 
35
34
  server_list = [
@@ -44,7 +43,6 @@ class Chef
44
43
  end
45
44
 
46
45
  # puts ui.list(server_list, :columns_across, 2)
47
-
48
46
  end
49
47
  end
50
48
  end
@@ -1,6 +1,6 @@
1
1
  module Knife
2
2
  module Linode
3
- VERSION = "0.3.2"
4
- MAJOR, MINOR, TINY = VERSION.split('.')
3
+ VERSION = "0.3.3"
4
+ MAJOR, MINOR, TINY = VERSION.split(".")
5
5
  end
6
6
  end
@@ -1,10 +1,10 @@
1
- require 'spec_helper'
2
- require 'linode_datacenter_list'
1
+ require "spec_helper"
2
+ require "linode_datacenter_list"
3
3
 
4
4
  describe Chef::Knife::LinodeDatacenterList do
5
5
  subject { Chef::Knife::LinodeDatacenterList.new }
6
6
 
7
- let(:api_key) { 'FAKE_API_KEY' }
7
+ let(:api_key) { "FAKE_API_KEY" }
8
8
 
9
9
  before :each do
10
10
  Chef::Knife::LinodeDatacenterList.load_deps
@@ -1,10 +1,10 @@
1
- require 'spec_helper'
2
- require 'linode_flavor_list'
1
+ require "spec_helper"
2
+ require "linode_flavor_list"
3
3
 
4
4
  describe Chef::Knife::LinodeFlavorList do
5
5
  subject { Chef::Knife::LinodeFlavorList.new }
6
6
 
7
- let(:api_key) { 'FAKE_API_KEY' }
7
+ let(:api_key) { "FAKE_API_KEY" }
8
8
 
9
9
  before :each do
10
10
  Chef::Knife::LinodeFlavorList.load_deps
@@ -1,16 +1,18 @@
1
- require 'spec_helper'
2
- require 'linode_server_create'
1
+ require "spec_helper"
2
+ require "linode_server_create"
3
3
 
4
4
  class MockSocket < BasicSocket
5
5
  def initialize; end
6
+
6
7
  def gets; end
8
+
7
9
  def close; end
8
10
  end
9
11
 
10
12
  describe Chef::Knife::LinodeServerCreate do
11
13
  subject { Chef::Knife::LinodeServerCreate.new }
12
14
 
13
- let(:api_key) { 'FAKE_API_KEY' }
15
+ let(:api_key) { "FAKE_API_KEY" }
14
16
  let(:mock_socket) { MockSocket.new }
15
17
 
16
18
  before :each do
@@ -48,15 +50,15 @@ describe Chef::Knife::LinodeServerCreate do
48
50
  end
49
51
 
50
52
  describe "#run" do
51
- let(:mock_bootstrap) {
53
+ let(:mock_bootstrap) do
52
54
  double("Chef::Knife::Bootstrap").tap do |mb|
53
55
  allow(mb).to receive(:run)
54
56
  allow(mb).to receive(:name_args=)
55
57
  allow(mb).to receive(:config).and_return({})
56
58
  end
57
- }
59
+ end
58
60
 
59
- let(:mock_server) {
61
+ let(:mock_server) do
60
62
  double("Fog::Compute::Linode::Server").tap do |ms|
61
63
  allow(ms).to receive(:ips).and_return([mock_ip("1.2.3.4")])
62
64
  allow(ms).to receive(:id).and_return(42)
@@ -64,13 +66,13 @@ describe Chef::Knife::LinodeServerCreate do
64
66
  allow(ms).to receive(:status).and_return(1)
65
67
  allow(ms).to receive(:public_ip_address)
66
68
  end
67
- }
69
+ end
68
70
 
69
- let(:mock_servers) {
71
+ let(:mock_servers) do
70
72
  double("Fog::Collection").tap do |ms|
71
73
  allow(subject.connection).to receive(:servers).and_return(ms)
72
74
  end
73
- }
75
+ end
74
76
 
75
77
  before :each do
76
78
  allow(Chef::Knife::Bootstrap).to receive(:new).and_return(mock_bootstrap)
@@ -85,12 +87,12 @@ describe Chef::Knife::LinodeServerCreate do
85
87
  end
86
88
 
87
89
  it "should call #create on the servers collection with the correct params" do
88
- skip 'fails - arg variable does not exist'
90
+ skip "fails - arg variable does not exist"
89
91
 
90
92
  configure_chef(subject)
91
93
 
92
94
  expect(mock_servers).to receive(:create) { |server|
93
- server.each do |k,v|
95
+ server.each do |k, v|
94
96
  case k
95
97
  when :data_center, :flavor, :image, :kernel
96
98
  expect(arg[k].id.to_i).to eq(v.id)
@@ -109,7 +111,7 @@ describe Chef::Knife::LinodeServerCreate do
109
111
  end
110
112
 
111
113
  it "should set the bootstrap name_args to the Linode's public IP" do
112
- ips = %w( 1.2.3.4 192.168.1.1 ).map { |ip| mock_ip(ip) }
114
+ ips = %w{ 1.2.3.4 192.168.1.1 }.map { |ip| mock_ip(ip) }
113
115
  allow(mock_server).to receive(:ips).and_return(ips)
114
116
  expect(mock_bootstrap).to receive(:name_args=).with([ips.first.ip])
115
117
 
@@ -176,7 +178,7 @@ def configure_chef(subject)
176
178
  }
177
179
 
178
180
  server_params = {}
179
- server.each do |k,v|
181
+ server.each do |k, v|
180
182
  case k
181
183
  when :data_center
182
184
  server_params[:datacenter] = v.id
@@ -188,7 +190,7 @@ def configure_chef(subject)
188
190
  end
189
191
 
190
192
  # setup the config before we call #run
191
- server_params.each do |k,v|
193
+ server_params.each do |k, v|
192
194
  case k
193
195
  when :name
194
196
  Chef::Config[:knife][:linode_node_name] = v
@@ -207,7 +209,7 @@ def configure_chef(subject)
207
209
  end
208
210
 
209
211
  cli_config = subject.config.dup
210
- chef_config.each do |k,v|
212
+ chef_config.each do |k, v|
211
213
  cli_config[k] = v
212
214
  end
213
215
  allow(subject).to receive(:config).and_return(cli_config)
@@ -1,10 +1,10 @@
1
- require 'spec_helper'
2
- require 'linode_server_list'
1
+ require "spec_helper"
2
+ require "linode_server_list"
3
3
 
4
4
  describe Chef::Knife::LinodeServerList do
5
5
  subject { Chef::Knife::LinodeServerList.new }
6
6
 
7
- let(:api_key) { 'FAKE_API_KEY' }
7
+ let(:api_key) { "FAKE_API_KEY" }
8
8
 
9
9
  before :each do
10
10
  Chef::Knife::LinodeServerList.load_deps
@@ -1,6 +1,6 @@
1
- require 'rspec'
2
- require 'fog'
1
+ require "rspec"
2
+ require "fog"
3
3
 
4
4
  Fog.mock!
5
5
 
6
- $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib', 'chef', 'knife'))
6
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), "..", "lib", "chef", "knife"))
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: knife-linode
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.2
4
+ version: 0.3.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adam Jacob
@@ -11,69 +11,27 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2014-12-23 00:00:00.000000000 Z
14
+ date: 2019-08-08 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: fog
18
18
  requirement: !ruby/object:Gem::Requirement
19
19
  requirements:
20
- - - ~>
20
+ - - "~>"
21
21
  - !ruby/object:Gem::Version
22
22
  version: '1.0'
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
26
26
  requirements:
27
- - - ~>
27
+ - - "~>"
28
28
  - !ruby/object:Gem::Version
29
29
  version: '1.0'
30
- - !ruby/object:Gem::Dependency
31
- name: chef
32
- requirement: !ruby/object:Gem::Requirement
33
- requirements:
34
- - - '>='
35
- - !ruby/object:Gem::Version
36
- version: '11.8'
37
- type: :runtime
38
- prerelease: false
39
- version_requirements: !ruby/object:Gem::Requirement
40
- requirements:
41
- - - '>='
42
- - !ruby/object:Gem::Version
43
- version: '11.8'
44
- - !ruby/object:Gem::Dependency
45
- name: rspec
46
- requirement: !ruby/object:Gem::Requirement
47
- requirements:
48
- - - ~>
49
- - !ruby/object:Gem::Version
50
- version: '3.0'
51
- type: :development
52
- prerelease: false
53
- version_requirements: !ruby/object:Gem::Requirement
54
- requirements:
55
- - - ~>
56
- - !ruby/object:Gem::Version
57
- version: '3.0'
58
- - !ruby/object:Gem::Dependency
59
- name: rubocop
60
- requirement: !ruby/object:Gem::Requirement
61
- requirements:
62
- - - ~>
63
- - !ruby/object:Gem::Version
64
- version: '0.24'
65
- type: :development
66
- prerelease: false
67
- version_requirements: !ruby/object:Gem::Requirement
68
- requirements:
69
- - - ~>
70
- - !ruby/object:Gem::Version
71
- version: '0.24'
72
30
  description: Linode Support for Chef's Knife Command
73
31
  email:
74
- - adam@opscode.com
75
- - schisamo@opscode.com
76
- - lamont@opscode.com
32
+ - adam@chef.io
33
+ - schisamo@chef.io
34
+ - lamont@chef.io
77
35
  - jesse@techno-geeks.org
78
36
  executables: []
79
37
  extensions: []
@@ -81,12 +39,25 @@ extra_rdoc_files:
81
39
  - README.md
82
40
  - LICENSE
83
41
  files:
84
- - .gitignore
85
- - .travis.yml
42
+ - ".expeditor/config.yml"
43
+ - ".expeditor/update_version.sh"
44
+ - ".github/CODEOWNERS"
45
+ - ".github/ISSUE_TEMPLATE/BUG_TEMPLATE.md"
46
+ - ".github/ISSUE_TEMPLATE/DESIGN_PROPOSAL.md"
47
+ - ".github/ISSUE_TEMPLATE/ENHANCEMENT_REQUEST_TEMPLATE.md"
48
+ - ".github/ISSUE_TEMPLATE/SUPPORT_QUESTION.md"
49
+ - ".github/PULL_REQUEST_TEMPLATE.md"
50
+ - ".github/lock.yml"
51
+ - ".gitignore"
52
+ - ".rspec"
53
+ - ".rubocop.yml"
54
+ - ".travis.yml"
55
+ - CHANGELOG.md
86
56
  - Gemfile
87
57
  - LICENSE
88
58
  - README.md
89
59
  - Rakefile
60
+ - VERSION
90
61
  - knife-linode.gemspec
91
62
  - lib/chef/knife/linode_base.rb
92
63
  - lib/chef/knife/linode_datacenter_list.rb
@@ -104,8 +75,9 @@ files:
104
75
  - spec/chef/knife/linode_server_create_spec.rb
105
76
  - spec/chef/knife/linode_server_list_spec.rb
106
77
  - spec/spec_helper.rb
107
- homepage: http://wiki.opscode.com/display/chef
108
- licenses: []
78
+ homepage: https://github.com/chef/knife-linode
79
+ licenses:
80
+ - Apache-2.0
109
81
  metadata: {}
110
82
  post_install_message:
111
83
  rdoc_options: []
@@ -113,18 +85,22 @@ require_paths:
113
85
  - lib
114
86
  required_ruby_version: !ruby/object:Gem::Requirement
115
87
  requirements:
116
- - - '>='
88
+ - - ">="
117
89
  - !ruby/object:Gem::Version
118
- version: '0'
90
+ version: 2.2.2
119
91
  required_rubygems_version: !ruby/object:Gem::Requirement
120
92
  requirements:
121
- - - '>='
93
+ - - ">="
122
94
  - !ruby/object:Gem::Version
123
95
  version: '0'
124
96
  requirements: []
125
- rubyforge_project:
126
- rubygems_version: 2.1.11
97
+ rubygems_version: 3.0.3
127
98
  signing_key:
128
99
  specification_version: 4
129
100
  summary: Linode Support for Chef's Knife Command
130
- test_files: []
101
+ test_files:
102
+ - spec/chef/knife/linode_datacenter_list_spec.rb
103
+ - spec/chef/knife/linode_flavor_list_spec.rb
104
+ - spec/chef/knife/linode_server_create_spec.rb
105
+ - spec/chef/knife/linode_server_list_spec.rb
106
+ - spec/spec_helper.rb