kontena-plugin-cloud 1.0.0 → 1.1.0.pre1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f54f4efba0517f8af5aa2d10caae9f68f0bd18c9
4
- data.tar.gz: 9948d9b7c0e3cb153cdad97139ed040297d9570a
3
+ metadata.gz: bf7c44e18f0d2ff2e277810974bf39f749257e3c
4
+ data.tar.gz: 2e2f5ba2d90c7a520af0841a5cafe24f64ac149e
5
5
  SHA512:
6
- metadata.gz: 494db6387d932a046993756423a65e730f13c74d1241ecbef58e89aacd61262d31b60eaae87b632e307e5549555700cca054971ac4de30d5de4a8fdfe75617a1
7
- data.tar.gz: 16d9f944fe522e868b1602527095e31ef027040b5a94bb6d284a57506178fbea3e83cbedf3206b822708a5f965faada5ab1a3a40485d2919ecc7df14c2496e0c
6
+ metadata.gz: 95f186f517ada7984687d566dca28a211e3afdb834485c774ea9bc801ea06896a86abb1893e5c384360a8b85dedf81631baabc7d40d5e560b4d3caa3131ee344
7
+ data.tar.gz: 1fad2520e64dd6082a03357012fad9696b9b95e8aefe4630e8389903fd5454fb887c787879aad0b0e1eb32549fa252ee48b18b7b24a839f41fe83ce980f7315c
@@ -7,10 +7,11 @@ class Kontena::Plugin::Cloud::Platform::CreateCommand < Kontena::Command
7
7
 
8
8
  parameter "[NAME]", "Platform name"
9
9
 
10
- option ['--organization'], 'ORG', 'Organization name', environment_variable: 'KONTENA_ORGANIZATION'
10
+ option ['--organization', '--org'], 'ORG', 'Organization name', environment_variable: 'KONTENA_ORGANIZATION'
11
11
  option ['--region'], 'region', 'Region (us-east, eu-west)'
12
12
  option ['--initial-size', '-i'], 'SIZE', 'Initial size (number of nodes) for platform'
13
13
  option '--[no-]use', :flag, 'Switch to use created platform', default: true
14
+ option '--version', 'VERSION', 'Platform version', visible: false
14
15
 
15
16
  def execute
16
17
  confirm("This will create managed platform to Kontena Cloud, proceed?")
@@ -79,6 +80,7 @@ class Kontena::Plugin::Cloud::Platform::CreateCommand < Kontena::Command
79
80
  }
80
81
  }
81
82
  }
83
+ data[:attributes]['version'] = self.version if self.version
82
84
  data = cloud_client.post("/organizations/#{organization}/platforms", { data: data })['data']
83
85
  Kontena::Cli::Models::Platform.new(data)
84
86
  end
@@ -18,6 +18,7 @@ class Kontena::Plugin::Cloud::Platform::ShowCommand < Kontena::Command
18
18
  puts "#{name}:"
19
19
  puts " name: #{platform.name}"
20
20
  puts " organization: #{current_organization}"
21
+ puts " version: #{platform.version}"
21
22
  puts " state: #{platform.state}"
22
23
  puts " region: #{platform.region || '-'}"
23
24
  puts " initial_size: #{platform.initial_size}"
@@ -0,0 +1,47 @@
1
+ require_relative 'common'
2
+
3
+ class Kontena::Plugin::Cloud::Platform::UpgradeCommand < Kontena::Command
4
+ include Kontena::Cli::Common
5
+ include Kontena::Plugin::Cloud::Platform::Common
6
+
7
+ requires_current_account_token
8
+
9
+ parameter "NAME", "Platform name"
10
+
11
+ option "--version", "VERSION", "Upgrade to given version"
12
+
13
+ def execute
14
+ require_platform(name)
15
+
16
+ platform = find_platform_by_name(current_platform, current_organization)
17
+ unless version
18
+ version = prompt_version(platform)
19
+ if Gem::Version.new(version) < Gem::Version.new(platform.version)
20
+ exit_with_error "Dowgrade is not supported"
21
+ end
22
+ end
23
+ data = {
24
+ attributes: {
25
+ name: platform.name,
26
+ version: platform.version
27
+ }
28
+ }
29
+ cloud_client.put("/organizations/#{current_organization}/platforms/#{platform.name}", { data: data })
30
+ end
31
+
32
+ # @param
33
+ def prompt_version(platform)
34
+ versions = cloud_client.get("/platform_versions")['data']
35
+
36
+ platform_version = Gem::Version.new(platform.version)
37
+ versions = versions.select { |v| Gem::Version.new(v['id']) > platform_version }
38
+
39
+ default_version = versions.find_index{ |v| v['id'] == platform.version } + 1
40
+ prompt.select("Upgrade to version:") do |menu|
41
+ menu.default default_version
42
+ versions.each do |v|
43
+ menu.choice v['id']
44
+ end
45
+ end
46
+ end
47
+ end
@@ -6,6 +6,7 @@ class Kontena::Plugin::Cloud::PlatformCommand < Kontena::Command
6
6
  subcommand ['remove', 'rm'], 'Remove platform', load_subcommand('kontena/plugin/cloud/platform/remove_command')
7
7
  subcommand ['join', 'byo'], 'Join grid as Kontena Platform', load_subcommand('kontena/plugin/cloud/platform/import_grid_command')
8
8
  subcommand 'user', 'User management commands', load_subcommand('kontena/plugin/cloud/platform/user_command')
9
+ subcommand 'upgrade', 'Upgrade platform version', load_subcommand('kontena/plugin/cloud/platform/upgrade_command')
9
10
 
10
11
  def execute
11
12
  end
@@ -1,7 +1,7 @@
1
1
  module Kontena
2
2
  module Plugin
3
3
  module Cloud
4
- VERSION = "1.0.0"
4
+ VERSION = "1.1.0.pre1"
5
5
 
6
6
  module Organization
7
7
  module User; end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kontena-plugin-cloud
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0.pre1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kontena, Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-08-30 00:00:00.000000000 Z
11
+ date: 2017-10-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: kontena-cli
@@ -86,6 +86,7 @@ files:
86
86
  - lib/kontena/plugin/cloud/platform/list_command.rb
87
87
  - lib/kontena/plugin/cloud/platform/remove_command.rb
88
88
  - lib/kontena/plugin/cloud/platform/show_command.rb
89
+ - lib/kontena/plugin/cloud/platform/upgrade_command.rb
89
90
  - lib/kontena/plugin/cloud/platform/use_command.rb
90
91
  - lib/kontena/plugin/cloud/platform/user/add_command.rb
91
92
  - lib/kontena/plugin/cloud/platform/user/list_command.rb
@@ -111,12 +112,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
111
112
  version: '0'
112
113
  required_rubygems_version: !ruby/object:Gem::Requirement
113
114
  requirements:
114
- - - ">="
115
+ - - ">"
115
116
  - !ruby/object:Gem::Version
116
- version: '0'
117
+ version: 1.3.1
117
118
  requirements: []
118
119
  rubyforge_project:
119
- rubygems_version: 2.6.13
120
+ rubygems_version: 2.6.11
120
121
  signing_key:
121
122
  specification_version: 4
122
123
  summary: Kontena Cloud management for Kontena CLI