From de2eb7af79d5e60094358408f4eab4996a465901 Mon Sep 17 00:00:00 2001 From: Brian Flad Date: Sat, 12 Apr 2014 22:54:53 -0400 Subject: [PATCH] Docker 0.10.0: Add --input flag to docker load, closes #118 --- CHANGELOG.md | 2 ++ README.md | 14 ++++++++++++-- providers/image.rb | 9 ++++++++- resources/image.rb | 1 + 4 files changed, 23 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9e160ef4bb..6113a92522 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -24,6 +24,7 @@ Attributes now available for all docker daemon flags as well as system IP forwar * REMOVED: container_dns* attributes (use replacement dns* attributes on daemon for all containers or docker_container dns* attributes instead) * DEPRECATED: bind_* attributes to match docker terminology (use host attribute instead) * Enhancement: [#115][]: Add IP forwarding attributes +* Enhancement: [#118][]: Docker 0.10.0: Add --input flag to docker load * Enhancement: [#119][]: Docker 0.10.0: Add support for --env-file to load environment variables from files * Enhancement: [#124][]: Add all docker daemon options as attributes * Enhancement: [#125][]: Use dns* attributes to set docker daemon options, not defaults per-container @@ -446,6 +447,7 @@ Lots of community contributions this release -- thanks! [#112]: https://github.com/bflad/chef-docker/issues/112 [#113]: https://github.com/bflad/chef-docker/issues/113 [#115]: https://github.com/bflad/chef-docker/issues/115 +[#118]: https://github.com/bflad/chef-docker/issues/118 [#119]: https://github.com/bflad/chef-docker/issues/119 [#124]: https://github.com/bflad/chef-docker/issues/124 [#125]: https://github.com/bflad/chef-docker/issues/125 diff --git a/README.md b/README.md index 2d3fbbb8ac..ff00d8cb8e 100644 --- a/README.md +++ b/README.md @@ -655,9 +655,19 @@ These attributes are associated with this LWRP action. Attribute | Description | Type | Default ----------|-------------|------|-------- -source | Source path/URL | String | nil +input | Image source (via tar archive file) | String | nil +source | Image source (via stdin) | String | nil + +Load repository via input: + +```ruby +docker_image 'test' do + input '/path/to/test.tar' + action :load +end +``` -Load repository from path: +Load repository via stdin: ```ruby docker_image 'test' do diff --git a/providers/image.rb b/providers/image.rb index 4b7811b44d..4272bc67f8 100644 --- a/providers/image.rb +++ b/providers/image.rb @@ -189,7 +189,14 @@ def installed? end def load - docker_cmd!("load < #{new_resource.source}") + if new_resource.input + load_args = cli_args( + 'input' => new_resource.input + ) + docker_cmd!("load #{load_args}") + else + docker_cmd!("load < #{new_resource.source}") + end end def pull diff --git a/resources/image.rb b/resources/image.rb index 583eddda58..0d8e779d05 100644 --- a/resources/image.rb +++ b/resources/image.rb @@ -13,6 +13,7 @@ attribute :id, :kind_of => [String] # DEPRECATED: Use source attribute attribute :image_url, :kind_of => [String] +attribute :input, :kind_of => [String] attribute :no_cache, :kind_of => [TrueClass, FalseClass], :default => false # DEPRECATED: Use source attribute attribute :path, :kind_of => [String]