berks_to_rightscale 0.0.4 → 0.0.5
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.
- data/lib/berks_to_rightscale/cli.rb +34 -4
- metadata +19 -14
@@ -19,6 +19,8 @@
|
|
19
19
|
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
20
|
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
21
21
|
|
22
|
+
require 'chef'
|
23
|
+
|
22
24
|
module BerksToRightscale
|
23
25
|
class Cli < Thor
|
24
26
|
|
@@ -30,6 +32,8 @@ module BerksToRightscale
|
|
30
32
|
option :no_cleanup, :desc => "Skips the removal of the cookbooks directory and the generated tar.gz file", :type => :boolean
|
31
33
|
option :provider, :desc => "A provider listed by list_destinations which will be used to upload the cookbook release", :required => true
|
32
34
|
option :container, :desc => "The name of the storage container to put the release file in.", :required => true
|
35
|
+
option :provider_options, :desc => "A comma-separated list of key=value options to pass to the fog storage provider. i.e. region=us-west-1", :required => false
|
36
|
+
|
33
37
|
def release(projectname, releasename)
|
34
38
|
output_path = ::File.join(Dir.pwd, "cookbooks")
|
35
39
|
sym_options = {}
|
@@ -42,14 +46,40 @@ module BerksToRightscale
|
|
42
46
|
|
43
47
|
fog_params = { :provider => final_opts[:provider] }
|
44
48
|
|
45
|
-
|
49
|
+
if final_opts[:provider_options]
|
50
|
+
provider_opts = { }
|
51
|
+
begin
|
52
|
+
# convert comma-separated list to hash
|
53
|
+
option_list = final_opts[:provider_options].split(",")
|
54
|
+
provider_opts = option_list.inject({}) do |hash, kv_pair|
|
55
|
+
kv = kv_pair.split("=")
|
56
|
+
raise "ERROR: value not found." unless kv[1]
|
57
|
+
hash.merge({ kv[0] => kv[1] })
|
58
|
+
end
|
59
|
+
rescue
|
60
|
+
puts "ERROR: malformed ---provider-options parameter. Must be in the form of 'opt1=value1,opt2=value2'. Please try again."
|
61
|
+
exit 1
|
62
|
+
end
|
63
|
+
# merge in provider options hash
|
64
|
+
fog_params.merge!(provider_opts)
|
65
|
+
end
|
66
|
+
|
67
|
+
|
68
|
+
begin
|
69
|
+
@fog = ::Fog::Storage.new(fog_params)
|
70
|
+
rescue Exception => e
|
71
|
+
puts "ERROR: Fog had a problem initializing storage provider: #{e.message}"
|
72
|
+
exit 1
|
73
|
+
end
|
46
74
|
|
47
|
-
unless container = fog.directories.all.detect {|cont| cont.key == final_opts[:container]}
|
48
|
-
|
75
|
+
unless container = @fog.directories.all.detect {|cont| cont.key == final_opts[:container]}
|
76
|
+
puts "There was no container named #{final_opts[:container]} for provider #{final_opts[:provider]}"
|
77
|
+
exit 1
|
49
78
|
end
|
50
79
|
|
51
80
|
if container.files.all.detect {|file| file.key == file_key} && !final_opts[:force]
|
52
|
-
|
81
|
+
puts "There is already a released named #{releasename} for the project #{projectname}. If you want to overwrite it, specify the --force flag"
|
82
|
+
exit 1
|
53
83
|
end
|
54
84
|
|
55
85
|
berksfile = ::Berkshelf::Berksfile.from_file(final_opts[:berksfile])
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: berks_to_rightscale
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-
|
12
|
+
date: 2013-07-12 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: berkshelf
|
@@ -18,7 +18,7 @@ dependencies:
|
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version:
|
21
|
+
version: 2.0.6
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
24
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -26,23 +26,23 @@ dependencies:
|
|
26
26
|
requirements:
|
27
27
|
- - ~>
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
version:
|
29
|
+
version: 2.0.6
|
30
30
|
- !ruby/object:Gem::Dependency
|
31
31
|
name: chef
|
32
32
|
requirement: !ruby/object:Gem::Requirement
|
33
33
|
none: false
|
34
34
|
requirements:
|
35
|
-
- -
|
35
|
+
- - ~>
|
36
36
|
- !ruby/object:Gem::Version
|
37
|
-
version:
|
37
|
+
version: 11.4.2
|
38
38
|
type: :runtime
|
39
39
|
prerelease: false
|
40
40
|
version_requirements: !ruby/object:Gem::Requirement
|
41
41
|
none: false
|
42
42
|
requirements:
|
43
|
-
- -
|
43
|
+
- - ~>
|
44
44
|
- !ruby/object:Gem::Version
|
45
|
-
version:
|
45
|
+
version: 11.4.2
|
46
46
|
- !ruby/object:Gem::Dependency
|
47
47
|
name: thor
|
48
48
|
requirement: !ruby/object:Gem::Requirement
|
@@ -50,7 +50,7 @@ dependencies:
|
|
50
50
|
requirements:
|
51
51
|
- - ~>
|
52
52
|
- !ruby/object:Gem::Version
|
53
|
-
version: 0.
|
53
|
+
version: 0.18.1
|
54
54
|
type: :runtime
|
55
55
|
prerelease: false
|
56
56
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -58,7 +58,7 @@ dependencies:
|
|
58
58
|
requirements:
|
59
59
|
- - ~>
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: 0.
|
61
|
+
version: 0.18.1
|
62
62
|
- !ruby/object:Gem::Dependency
|
63
63
|
name: fog
|
64
64
|
requirement: !ruby/object:Gem::Requirement
|
@@ -66,7 +66,7 @@ dependencies:
|
|
66
66
|
requirements:
|
67
67
|
- - ~>
|
68
68
|
- !ruby/object:Gem::Version
|
69
|
-
version:
|
69
|
+
version: 1.12.1
|
70
70
|
type: :runtime
|
71
71
|
prerelease: false
|
72
72
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -74,7 +74,7 @@ dependencies:
|
|
74
74
|
requirements:
|
75
75
|
- - ~>
|
76
76
|
- !ruby/object:Gem::Version
|
77
|
-
version:
|
77
|
+
version: 1.12.1
|
78
78
|
description: A commandline utility which will collect cookbooks defined by berkshelf,
|
79
79
|
compress them, and store them in S3 to be fetched by RightScale
|
80
80
|
email: ryan.geyer@rightscale.com
|
@@ -101,18 +101,23 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
101
101
|
- - ! '>='
|
102
102
|
- !ruby/object:Gem::Version
|
103
103
|
version: '0'
|
104
|
+
segments:
|
105
|
+
- 0
|
106
|
+
hash: -1233697905389694565
|
104
107
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
105
108
|
none: false
|
106
109
|
requirements:
|
107
110
|
- - ! '>='
|
108
111
|
- !ruby/object:Gem::Version
|
109
112
|
version: '0'
|
113
|
+
segments:
|
114
|
+
- 0
|
115
|
+
hash: -1233697905389694565
|
110
116
|
requirements: []
|
111
117
|
rubyforge_project:
|
112
|
-
rubygems_version: 1.8.
|
118
|
+
rubygems_version: 1.8.25
|
113
119
|
signing_key:
|
114
120
|
specification_version: 3
|
115
121
|
summary: A commandline utility which will collect cookbooks defined by berkshelf,
|
116
122
|
compress them, and store them in S3 to be fetched by RightScale
|
117
123
|
test_files: []
|
118
|
-
has_rdoc:
|