berks_to_rightscale 0.0.1
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/LICENSE.txt +20 -0
- data/README.rdoc +95 -0
- data/bin/berks_to_rightscale +26 -0
- data/lib/berks_to_rightscale/cli.rb +77 -0
- data/lib/berks_to_rightscale.rb +26 -0
- metadata +107 -0
data/LICENSE.txt
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2012 Ryan J. Geyer
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
'Software'), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
17
|
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
18
|
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
19
|
+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
20
|
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.rdoc
ADDED
@@ -0,0 +1,95 @@
|
|
1
|
+
# berks_to_rightscale
|
2
|
+
|
3
|
+
This is primarily a commandline tool for injesting a Berksfile and uploading the resulting set of cookbooks to a tar.gz file in any storage provider supported by [fog](https://rubygems.org/gems/fog)
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
gem install berks_to_rightscale
|
8
|
+
|
9
|
+
## Usage
|
10
|
+
|
11
|
+
This requires a ~/.fog configuration file with the proper credentials for any storage provider(s) you wish to use. To get an example of the ~/.fog config file do the following after installing berks_to_rightscale (shown above)
|
12
|
+
|
13
|
+
fog [1.9.3-p194]
|
14
|
+
Missing Credentials
|
15
|
+
|
16
|
+
To run as 'default', add the following to your resource config file: /Users/ryangeyer/.fog
|
17
|
+
An alternate file may be used by placing its path in the FOG_RC environment variable
|
18
|
+
|
19
|
+
#######################################################
|
20
|
+
# Fog Credentials File
|
21
|
+
#
|
22
|
+
# Key-value pairs should look like:
|
23
|
+
# :aws_access_key_id: 022QF06E7MXBSAMPLE
|
24
|
+
:default:
|
25
|
+
:aws_access_key_id:
|
26
|
+
:aws_secret_access_key:
|
27
|
+
:bluebox_api_key:
|
28
|
+
:bluebox_customer_id:
|
29
|
+
:brightbox_client_id:
|
30
|
+
:brightbox_secret:
|
31
|
+
:clodo_api_key:
|
32
|
+
:clodo_username:
|
33
|
+
:go_grid_api_key:
|
34
|
+
:go_grid_shared_secret:
|
35
|
+
:google_storage_access_key_id:
|
36
|
+
:google_storage_secret_access_key:
|
37
|
+
:hp_account_id:
|
38
|
+
:hp_secret_key:
|
39
|
+
:hp_tenant_id:
|
40
|
+
:linode_api_key:
|
41
|
+
:local_root:
|
42
|
+
:bare_metal_cloud_password:
|
43
|
+
:bare_metal_cloud_username:
|
44
|
+
:public_key_path:
|
45
|
+
:private_key_path:
|
46
|
+
:openstack_api_key:
|
47
|
+
:openstack_username:
|
48
|
+
:openstack_auth_url:
|
49
|
+
:openstack_tenant:
|
50
|
+
:openstack_region:
|
51
|
+
:ovirt_username:
|
52
|
+
:ovirt_password:
|
53
|
+
:ovirt_url:
|
54
|
+
:libvirt_uri:
|
55
|
+
:rackspace_api_key:
|
56
|
+
:rackspace_username:
|
57
|
+
:rackspace_servicenet:
|
58
|
+
:rackspace_cdn_ssl:
|
59
|
+
:stormondemand_username:
|
60
|
+
:stormondemand_password:
|
61
|
+
:terremark_username:
|
62
|
+
:terremark_password:
|
63
|
+
:voxel_api_key:
|
64
|
+
:voxel_api_secret:
|
65
|
+
:zerigo_email:
|
66
|
+
:zerigo_token:
|
67
|
+
:dnsimple_email:
|
68
|
+
:dnsimple_password:
|
69
|
+
:dnsmadeeasy_api_key:
|
70
|
+
:dnsmadeeasy_secret_key:
|
71
|
+
:cloudstack_host:
|
72
|
+
:cloudstack_api_key:
|
73
|
+
:cloudstack_secret_access_key:
|
74
|
+
:vsphere_server:
|
75
|
+
:vsphere_username:
|
76
|
+
:vsphere_password:
|
77
|
+
:libvirt_username:
|
78
|
+
:libvirt_password:
|
79
|
+
:libvirt_uri:
|
80
|
+
:libvirt_ip_command:
|
81
|
+
:ibm_username:
|
82
|
+
:ibm_password:
|
83
|
+
#
|
84
|
+
# End of Fog Credentials File
|
85
|
+
#######################################################
|
86
|
+
|
87
|
+
Copy everything from :default: to the end of the output, and paste it into ~/.fog, then supply the credentials for the storage provider(s) you want to use.
|
88
|
+
|
89
|
+
## TODO
|
90
|
+
|
91
|
+
* There are no specs, partially because there isn't much that is done specifically by this app, it just assembles other things.
|
92
|
+
|
93
|
+
## Copyright
|
94
|
+
|
95
|
+
Copyright (c) 2012 Ryan J. Geyer. See LICENSE.txt for further details.
|
@@ -0,0 +1,26 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
# Copyright (c) 2012 Ryan J. Geyer
|
4
|
+
#
|
5
|
+
# Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
# a copy of this software and associated documentation files (the
|
7
|
+
# "Software"), to deal in the Software without restriction, including
|
8
|
+
# without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
# distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
# permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
# the following conditions:
|
12
|
+
#
|
13
|
+
# The above copyright notice and this permission notice shall be
|
14
|
+
# included in all copies or substantial portions of the Software.
|
15
|
+
#
|
16
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
23
|
+
|
24
|
+
require File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib', 'berks_to_rightscale'))
|
25
|
+
|
26
|
+
BerksToRightscale::Cli.start(ARGV)
|
@@ -0,0 +1,77 @@
|
|
1
|
+
# Copyright (c) 2012 Ryan J. Geyer
|
2
|
+
#
|
3
|
+
# Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
# a copy of this software and associated documentation files (the
|
5
|
+
# "Software"), to deal in the Software without restriction, including
|
6
|
+
# without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
# distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
# permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
# the following conditions:
|
10
|
+
#
|
11
|
+
# The above copyright notice and this permission notice shall be
|
12
|
+
# included in all copies or substantial portions of the Software.
|
13
|
+
#
|
14
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
21
|
+
|
22
|
+
module BerksToRightscale
|
23
|
+
class Cli < Thor
|
24
|
+
|
25
|
+
desc "release PROJECTNAME RELEASENAME", "Releases the Cookbooks specified by a Berksfile or Berksfile.lock as a [PROJECTNAME]/[RELEASENAME].tar.gz file to the specified location."
|
26
|
+
option :except, :desc => "Exclude cookbooks that are in these groups.", :type => :array
|
27
|
+
option :only, :desc => "Only cookbooks that are in these groups.", :type => :array
|
28
|
+
option :berksfile, :banner => "PATH", :desc => "Path to a Berksfile to operate off of.", :default => File.join(Dir.pwd, ::Berkshelf::DEFAULT_FILENAME)
|
29
|
+
option :force, :desc => "Forces the current release with the same name to be overwritten.", :type => :boolean
|
30
|
+
option :provider, :desc => "A provider listed by list_destinations which will be used to upload the cookbook release", :required => true
|
31
|
+
option :container, :desc => "The name of the storage container to put the release file in.", :required => true
|
32
|
+
def release(projectname, releasename)
|
33
|
+
output_path = ::File.join(Dir.pwd, "cookbooks")
|
34
|
+
sym_options = {}
|
35
|
+
options.each{|k,v| sym_options[k.to_sym] = v }
|
36
|
+
final_opts = {:path => output_path, :force => false}.merge(sym_options)
|
37
|
+
tarball = "#{releasename}.tar.gz"
|
38
|
+
file_key = "#{projectname}/#{tarball}"
|
39
|
+
|
40
|
+
tarball_path = ::File.join(Dir.pwd, tarball)
|
41
|
+
|
42
|
+
fog_params = { :provider => final_opts[:provider] }
|
43
|
+
|
44
|
+
fog = ::Fog::Storage.new(fog_params)
|
45
|
+
|
46
|
+
unless container = fog.directories.all.detect {|cont| cont.key == final_opts[:container]}
|
47
|
+
raise "There was no container named #{final_opts[:container]} for provider #{final_opts[:provider]}"
|
48
|
+
end
|
49
|
+
|
50
|
+
if container.files.all.detect {|file| file.key == file_key} && !final_opts[:force]
|
51
|
+
raise "There is already a released named #{releasename} for the project #{projectname}. If you want to overwrite it, specify the --force flag"
|
52
|
+
end
|
53
|
+
|
54
|
+
berksfile = ::Berkshelf::Berksfile.from_file(final_opts[:berksfile])
|
55
|
+
berksfile.install(final_opts)
|
56
|
+
|
57
|
+
puts "Creating a tarball containing the specified cookbooks"
|
58
|
+
`tar -zcvf #{tarball_path} #{output_path} 2>&1`
|
59
|
+
|
60
|
+
file = File.open(tarball_path, 'r')
|
61
|
+
fog_file = container.files.create(:key => file_key, :body => file, :acl => 'public-read')
|
62
|
+
fog_file.save
|
63
|
+
file.close
|
64
|
+
|
65
|
+
puts "Released file can be found at #{fog_file.public_url}"
|
66
|
+
|
67
|
+
# Cleanup
|
68
|
+
FileUtils.rm tarball if File.exist? tarball
|
69
|
+
FileUtils.rm_rf output_path if File.directory? output_path
|
70
|
+
end
|
71
|
+
|
72
|
+
desc "list_destinations", "Lists all possible release locations. Basically a list of supported fog storage providers"
|
73
|
+
def list_destinations
|
74
|
+
puts ::Fog::Storage.providers
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# Copyright (c) 2012 Ryan J. Geyer
|
2
|
+
#
|
3
|
+
# Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
# a copy of this software and associated documentation files (the
|
5
|
+
# "Software"), to deal in the Software without restriction, including
|
6
|
+
# without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
# distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
# permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
# the following conditions:
|
10
|
+
#
|
11
|
+
# The above copyright notice and this permission notice shall be
|
12
|
+
# included in all copies or substantial portions of the Software.
|
13
|
+
#
|
14
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
21
|
+
|
22
|
+
require 'berkshelf'
|
23
|
+
require 'fog'
|
24
|
+
require 'thor'
|
25
|
+
|
26
|
+
require 'berks_to_rightscale/cli'
|
metadata
ADDED
@@ -0,0 +1,107 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: berks_to_rightscale
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Ryan J. Geyer
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2013-01-04 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: berkshelf
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ~>
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '1.1'
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ~>
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '1.1'
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: thor
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ~>
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: 0.16.0
|
38
|
+
type: :runtime
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ~>
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: 0.16.0
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: fog
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ~>
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '1.7'
|
54
|
+
type: :runtime
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ~>
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '1.7'
|
62
|
+
description: A commandline utility which will collect cookbooks defined by berkshelf,
|
63
|
+
compress them, and store them in S3 to be fetched by RightScale
|
64
|
+
email: ryan.geyer@rightscale.com
|
65
|
+
executables:
|
66
|
+
- berks_to_rightscale
|
67
|
+
extensions: []
|
68
|
+
extra_rdoc_files: []
|
69
|
+
files:
|
70
|
+
- lib/berks_to_rightscale/cli.rb
|
71
|
+
- lib/berks_to_rightscale.rb
|
72
|
+
- bin/berks_to_rightscale
|
73
|
+
- LICENSE.txt
|
74
|
+
- README.rdoc
|
75
|
+
homepage: https://github.com/rgeyer/berks_to_rightscale
|
76
|
+
licenses:
|
77
|
+
- MIT
|
78
|
+
post_install_message:
|
79
|
+
rdoc_options: []
|
80
|
+
require_paths:
|
81
|
+
- lib
|
82
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
83
|
+
none: false
|
84
|
+
requirements:
|
85
|
+
- - ! '>='
|
86
|
+
- !ruby/object:Gem::Version
|
87
|
+
version: '0'
|
88
|
+
segments:
|
89
|
+
- 0
|
90
|
+
hash: -2913936428031306561
|
91
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
92
|
+
none: false
|
93
|
+
requirements:
|
94
|
+
- - ! '>='
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
segments:
|
98
|
+
- 0
|
99
|
+
hash: -2913936428031306561
|
100
|
+
requirements: []
|
101
|
+
rubyforge_project:
|
102
|
+
rubygems_version: 1.8.24
|
103
|
+
signing_key:
|
104
|
+
specification_version: 3
|
105
|
+
summary: A commandline utility which will collect cookbooks defined by berkshelf,
|
106
|
+
compress them, and store them in S3 to be fetched by RightScale
|
107
|
+
test_files: []
|