hyperkit 1.2.0 → 1.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
- SHA1:
3
- metadata.gz: 2b8649ccbf6e0b7c64ccab512c52887d515fb8a3
4
- data.tar.gz: b424c31fa214f3b21432c86c7bff242005d25927
2
+ SHA256:
3
+ metadata.gz: 4d2caa2f80d739680a347aa9678a11adb20bc6cd074c3708bc3ab51b43c6ccfa
4
+ data.tar.gz: e11c4d3f981d541bb460e24e91c9da0e0afe28172eccccc4af941fb71fb5e0a7
5
5
  SHA512:
6
- metadata.gz: 98dd6f096fed43f6e0bdec21ea4636b65d520b523630265e68c33a4f2596c3506738f96048f221618f6c79c613b77c55c03bfa58075c2dac526da7582abc16a1
7
- data.tar.gz: 3d2fd3e5e7e019c2111adbde5a0a6e98557823360f9d17448fb56399f2bb58aea6f58b4a9093d5dd9946fea7bbbdbf15501eb1c6deee047e7e93d5d2d5b91f81
6
+ metadata.gz: bd51c31eb7831fa4b6f452c128e16d03f6ab427010820af8e68a95e7de5d6d291d1cddd5c8eb01261c1d50a4d1cd665bc00ccf2e347f10eec1adae9c8424e49b
7
+ data.tar.gz: e5cf9de68bd7ae698127453dd89a0863d94ff18a9f3058d3d2e2e557c02731819c5a7ff74f1378d78912e881bf61bb308b8c648046eeaa9f7d38b560bfab3ab3
@@ -8,7 +8,7 @@ module Hyperkit
8
8
  # Methods for the containers API
9
9
  #
10
10
  # @see Hyperkit::Client
11
- # @see https://github.com/lxc/lxd/blob/master/specs/rest-api.md
11
+ # @see https://github.com/lxc/lxd/blob/master/doc/rest-api.md
12
12
  module Containers
13
13
 
14
14
  # @!group Retrieval
@@ -1031,7 +1031,7 @@ module Hyperkit
1031
1031
  end
1032
1032
 
1033
1033
  def extract_container_options(name, options)
1034
- opts = options.slice(:architecture, :profiles, :ephemeral, :config).
1034
+ opts = options.slice(:architecture, :profiles, :ephemeral, :config, :devices).
1035
1035
  merge({ name: name })
1036
1036
 
1037
1037
  opts[:config] = stringify_hash(opts[:config]) if opts[:config]
@@ -5,7 +5,7 @@ module Hyperkit
5
5
  # Methods for the images API
6
6
  #
7
7
  # @see Hyperkit::Client
8
- # @see https://github.com/lxc/lxd/blob/master/specs/rest-api.md
8
+ # @see https://github.com/lxc/lxd/blob/master/doc/rest-api.md
9
9
  module Images
10
10
 
11
11
  # @!group Retrieval
@@ -5,7 +5,7 @@ module Hyperkit
5
5
  # Methods for the networks API
6
6
  #
7
7
  # @see Hyperkit::Client
8
- # @see https://github.com/lxc/lxd/blob/master/specs/rest-api.md
8
+ # @see https://github.com/lxc/lxd/blob/master/doc/rest-api.md
9
9
  module Networks
10
10
 
11
11
  # List of networks defined on the host
@@ -44,4 +44,3 @@ module Hyperkit
44
44
  end
45
45
 
46
46
  end
47
-
@@ -7,7 +7,7 @@ module Hyperkit
7
7
  # Methods for the operations API
8
8
  #
9
9
  # @see Hyperkit::Client
10
- # @see https://github.com/lxc/lxd/blob/master/specs/rest-api.md
10
+ # @see https://github.com/lxc/lxd/blob/master/doc/rest-api.md
11
11
  module Operations
12
12
 
13
13
  # List of operations active on the server
@@ -125,4 +125,3 @@ module Hyperkit
125
125
  end
126
126
 
127
127
  end
128
-
@@ -7,7 +7,7 @@ module Hyperkit
7
7
  # Methods for the profiles API
8
8
  #
9
9
  # @see Hyperkit::Client
10
- # @see https://github.com/lxc/lxd/blob/master/specs/rest-api.md
10
+ # @see https://github.com/lxc/lxd/blob/master/doc/rest-api.md
11
11
  module Profiles
12
12
 
13
13
  # List of profiles on the server
@@ -92,6 +92,28 @@ module Hyperkit
92
92
  put(profile_path(name), opts).metadata
93
93
  end
94
94
 
95
+ # Patch an existing profile using patch api
96
+ #
97
+ # @param name [String] Profile name
98
+ # @param options [Hash] Additional data to be passed
99
+ # @option options [Hash] :config Profile configuration. It will be merged with existing configuration
100
+ # @option options [String] :description Profile description
101
+ # @option options [Hash] :devices Profile devices. Existing devices will be merged
102
+ # @return [Sawyer::Resource]
103
+ #
104
+ # @example Patch profile with config (config is merged)
105
+ # Hyperkit.patch_profile("test-profile", config: {
106
+ # "limits.memory" => "4GB",
107
+ # "limits.cpu" => 4,
108
+ # "raw.lxc" => "lxc.aa_profile = unconfined"
109
+ # })
110
+ #
111
+ def patch_profile(name, options={})
112
+ opts = options.except(:name)
113
+ opts[:config] = stringify_hash(opts[:config]) if opts[:config]
114
+ patch(profile_path(name), opts).metadata
115
+ end
116
+
95
117
  # Rename a profile
96
118
  #
97
119
  # @param old_name [String] Existing profile name
@@ -168,7 +168,7 @@ module Hyperkit
168
168
  end
169
169
 
170
170
  if client_key && File.exist?(client_key)
171
- conn_opts[:ssl][:client_key] = OpenSSL::PKey::RSA.new(File.read(client_key))
171
+ conn_opts[:ssl][:client_key] = OpenSSL::PKey.read(File.read(client_key))
172
172
  end
173
173
 
174
174
  opts[:faraday] = Faraday.new(conn_opts)
@@ -10,7 +10,7 @@ module Hyperkit
10
10
  # Taken from Octokit, which was originally adapted from
11
11
  # https://github.com/lostisland/faraday_middleware/blob/138766e/lib/faraday_middleware/response/follow_redirects.rb
12
12
 
13
- class RedirectLimitReached < Faraday::Error::ClientError
13
+ class RedirectLimitReached < Faraday::ClientError
14
14
  attr_reader :response
15
15
 
16
16
  def initialize(response)
@@ -1,3 +1,3 @@
1
1
  module Hyperkit
2
- VERSION = "1.2.0"
2
+ VERSION = "1.3.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hyperkit
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeff Shantz
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-03-06 00:00:00.000000000 Z
11
+ date: 2020-08-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -108,8 +108,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
108
108
  - !ruby/object:Gem::Version
109
109
  version: '0'
110
110
  requirements: []
111
- rubyforge_project:
112
- rubygems_version: 2.6.11
111
+ rubygems_version: 3.1.2
113
112
  signing_key:
114
113
  specification_version: 4
115
114
  summary: Hyperkit is a flat API wrapper for LXD, the next-generation hypervisor