right_link 5.9.0
Sign up to get free protection for your applications and to get access to all the features.
- data/actors/agent_manager.rb +88 -0
- data/actors/instance_scheduler.rb +321 -0
- data/actors/instance_services.rb +64 -0
- data/actors/instance_setup.rb +567 -0
- data/bin/cloud +25 -0
- data/bin/cook_runner +44 -0
- data/bin/deploy +120 -0
- data/bin/enroll +385 -0
- data/bin/rad +32 -0
- data/bin/rchk +29 -0
- data/bin/rnac +39 -0
- data/bin/rs_connect +33 -0
- data/bin/rs_log_level +31 -0
- data/bin/rs_ohai +28 -0
- data/bin/rs_reenroll +31 -0
- data/bin/rs_run_recipe +34 -0
- data/bin/rs_run_right_script +34 -0
- data/bin/rs_shutdown +33 -0
- data/bin/rs_tag +33 -0
- data/bin/rs_thunk +33 -0
- data/bin/rstat +31 -0
- data/bin/system +16 -0
- data/ext/Rakefile +18 -0
- data/init/config.yml +5 -0
- data/init/init.rb +79 -0
- data/lib/chef/ohai_setup.rb +51 -0
- data/lib/chef/plugins/cloud.rb +91 -0
- data/lib/chef/plugins/cloudstack.rb +23 -0
- data/lib/chef/plugins/ec2.rb +23 -0
- data/lib/chef/plugins/linux/block_device2.rb +24 -0
- data/lib/chef/plugins/rackspace.rb +23 -0
- data/lib/chef/plugins/rightscale.rb +125 -0
- data/lib/chef/plugins/windows/network.rb +114 -0
- data/lib/chef/plugins.rb +74 -0
- data/lib/chef/providers/dns_dnsmadeeasy_provider.rb +81 -0
- data/lib/chef/providers/dns_resource.rb +100 -0
- data/lib/chef/providers/executable_schedule_provider.rb +70 -0
- data/lib/chef/providers/executable_schedule_resource.rb +144 -0
- data/lib/chef/providers/remote_recipe_provider.rb +86 -0
- data/lib/chef/providers/remote_recipe_resource.rb +101 -0
- data/lib/chef/providers/right_link_tag_provider.rb +73 -0
- data/lib/chef/providers/right_link_tag_resource.rb +59 -0
- data/lib/chef/providers/right_script_provider.rb +190 -0
- data/lib/chef/providers/right_script_resource.rb +113 -0
- data/lib/chef/providers/rs_shutdown_provider.rb +75 -0
- data/lib/chef/providers/rs_shutdown_resource.rb +55 -0
- data/lib/chef/providers/server_collection_provider.rb +66 -0
- data/lib/chef/providers/server_collection_resource.rb +93 -0
- data/lib/chef/providers/windows/powershell_provider.rb +151 -0
- data/lib/chef/providers/windows/powershell_resource.rb +111 -0
- data/lib/chef/providers/windows/unsupported_provider.rb +51 -0
- data/lib/chef/right_providers.rb +55 -0
- data/lib/chef/windows/ChefNodeCmdlet/ChefNodeCmdlet/ChefNodeCmdlet.csproj +104 -0
- data/lib/chef/windows/ChefNodeCmdlet/ChefNodeCmdlet/ChefNodeCmdlet.dll-Help.xml +141 -0
- data/lib/chef/windows/ChefNodeCmdlet/ChefNodeCmdlet/Exceptions.cs +182 -0
- data/lib/chef/windows/ChefNodeCmdlet/ChefNodeCmdlet/GetChefNodeCommand.cs +58 -0
- data/lib/chef/windows/ChefNodeCmdlet/ChefNodeCmdlet/GetChefNodeRequest.cs +46 -0
- data/lib/chef/windows/ChefNodeCmdlet/ChefNodeCmdlet/GetChefNodeResponse.cs +45 -0
- data/lib/chef/windows/ChefNodeCmdlet/ChefNodeCmdlet/GetCurrentResourceCommand.cs +58 -0
- data/lib/chef/windows/ChefNodeCmdlet/ChefNodeCmdlet/GetCurrentResourceRequest.cs +46 -0
- data/lib/chef/windows/ChefNodeCmdlet/ChefNodeCmdlet/GetCurrentResourceResponse.cs +45 -0
- data/lib/chef/windows/ChefNodeCmdlet/ChefNodeCmdlet/GetNewResourceCommand.cs +58 -0
- data/lib/chef/windows/ChefNodeCmdlet/ChefNodeCmdlet/GetNewResourceRequest.cs +46 -0
- data/lib/chef/windows/ChefNodeCmdlet/ChefNodeCmdlet/GetNewResourceResponse.cs +45 -0
- data/lib/chef/windows/ChefNodeCmdlet/ChefNodeCmdlet/GetNextActionCommand.cs +178 -0
- data/lib/chef/windows/ChefNodeCmdlet/ChefNodeCmdlet/GetNextActionRequest.cs +67 -0
- data/lib/chef/windows/ChefNodeCmdlet/ChefNodeCmdlet/GetNextActionResponse.cs +58 -0
- data/lib/chef/windows/ChefNodeCmdlet/ChefNodeCmdlet/GetNodeValueCommandBase.cs +142 -0
- data/lib/chef/windows/ChefNodeCmdlet/ChefNodeCmdlet/GetNodeValueRequestBase.cs +64 -0
- data/lib/chef/windows/ChefNodeCmdlet/ChefNodeCmdlet/GetNodeValueResponseBase.cs +69 -0
- data/lib/chef/windows/ChefNodeCmdlet/ChefNodeCmdlet/JsonTransport.cs +110 -0
- data/lib/chef/windows/ChefNodeCmdlet/ChefNodeCmdlet/PipeClient.cs +158 -0
- data/lib/chef/windows/ChefNodeCmdlet/ChefNodeCmdlet/PipeServer.cs +142 -0
- data/lib/chef/windows/ChefNodeCmdlet/ChefNodeCmdlet/Properties/AssemblyInfo.cs +16 -0
- data/lib/chef/windows/ChefNodeCmdlet/ChefNodeCmdlet/ProtocolConstants.cs +55 -0
- data/lib/chef/windows/ChefNodeCmdlet/ChefNodeCmdlet/ProtocolUtilities.cs +77 -0
- data/lib/chef/windows/ChefNodeCmdlet/ChefNodeCmdlet/ReadMe.txt +53 -0
- data/lib/chef/windows/ChefNodeCmdlet/ChefNodeCmdlet/SetChefNodeCommand.cs +59 -0
- data/lib/chef/windows/ChefNodeCmdlet/ChefNodeCmdlet/SetChefNodeRequest.cs +46 -0
- data/lib/chef/windows/ChefNodeCmdlet/ChefNodeCmdlet/SetChefNodeResponse.cs +58 -0
- data/lib/chef/windows/ChefNodeCmdlet/ChefNodeCmdlet/SetCurrentResourceCommand.cs +59 -0
- data/lib/chef/windows/ChefNodeCmdlet/ChefNodeCmdlet/SetCurrentResourceRequest.cs +46 -0
- data/lib/chef/windows/ChefNodeCmdlet/ChefNodeCmdlet/SetCurrentResourceResponse.cs +40 -0
- data/lib/chef/windows/ChefNodeCmdlet/ChefNodeCmdlet/SetNewResourceCommand.cs +59 -0
- data/lib/chef/windows/ChefNodeCmdlet/ChefNodeCmdlet/SetNewResourceRequest.cs +46 -0
- data/lib/chef/windows/ChefNodeCmdlet/ChefNodeCmdlet/SetNewResourceResponse.cs +40 -0
- data/lib/chef/windows/ChefNodeCmdlet/ChefNodeCmdlet/SetNodeValueCommandBase.cs +293 -0
- data/lib/chef/windows/ChefNodeCmdlet/ChefNodeCmdlet/SetNodeValueRequestBase.cs +75 -0
- data/lib/chef/windows/ChefNodeCmdlet/ChefNodeCmdlet/SetNodeValueResponseBase.cs +45 -0
- data/lib/chef/windows/ChefNodeCmdlet/ChefNodeCmdlet/Transport.cs +91 -0
- data/lib/chef/windows/ChefNodeCmdlet/ChefNodeCmdlet.sln +35 -0
- data/lib/chef/windows/ChefNodeCmdlet/TestChefNodeCmdlet/Program.cs +374 -0
- data/lib/chef/windows/ChefNodeCmdlet/TestChefNodeCmdlet/Properties/AssemblyInfo.cs +16 -0
- data/lib/chef/windows/ChefNodeCmdlet/TestChefNodeCmdlet/TestChefNodeCmdlet.csproj +65 -0
- data/lib/chef/windows/ChefNodeCmdlet/TestNextActionCmdlet/Program.cs +136 -0
- data/lib/chef/windows/ChefNodeCmdlet/TestNextActionCmdlet/Properties/AssemblyInfo.cs +36 -0
- data/lib/chef/windows/ChefNodeCmdlet/TestNextActionCmdlet/ReadMe.txt +46 -0
- data/lib/chef/windows/ChefNodeCmdlet/TestNextActionCmdlet/TestNextActionCmdlet.csproj +68 -0
- data/lib/chef/windows/bin/Newtonsoft.Json.dll +0 -0
- data/lib/chef/windows/chef_node_server.rb +463 -0
- data/lib/chef/windows/dynamic_powershell_provider.rb +296 -0
- data/lib/chef/windows/pipe_server.rb +283 -0
- data/lib/chef/windows/powershell_host.rb +285 -0
- data/lib/chef/windows/powershell_pipe_server.rb +136 -0
- data/lib/chef/windows/powershell_provider_base.rb +92 -0
- data/lib/chef/windows/scripts/run_loop.ps1 +105 -0
- data/lib/clouds/cloud.rb +557 -0
- data/lib/clouds/cloud_factory.rb +250 -0
- data/lib/clouds/cloud_utilities.rb +244 -0
- data/lib/clouds/clouds/azure.rb +106 -0
- data/lib/clouds/clouds/cloudstack.rb +114 -0
- data/lib/clouds/clouds/ec2.rb +113 -0
- data/lib/clouds/clouds/eucalyptus.rb +46 -0
- data/lib/clouds/clouds/google.rb +102 -0
- data/lib/clouds/clouds/none.rb +76 -0
- data/lib/clouds/clouds/openstack.rb +30 -0
- data/lib/clouds/clouds/rackspace-ng.rb +54 -0
- data/lib/clouds/clouds/rackspace.rb +78 -0
- data/lib/clouds/clouds/softlayer.rb +91 -0
- data/lib/clouds/metadata_formatter.rb +108 -0
- data/lib/clouds/metadata_provider.rb +128 -0
- data/lib/clouds/metadata_source.rb +87 -0
- data/lib/clouds/metadata_sources/certificate_metadata_source.rb +207 -0
- data/lib/clouds/metadata_sources/config_drive_metadata_source.rb +129 -0
- data/lib/clouds/metadata_sources/file_metadata_source.rb +74 -0
- data/lib/clouds/metadata_sources/http_metadata_source.rb +277 -0
- data/lib/clouds/metadata_sources/selective_metadata_source.rb +122 -0
- data/lib/clouds/metadata_tree_climber.rb +144 -0
- data/lib/clouds/metadata_writer.rb +155 -0
- data/lib/clouds/metadata_writers/dictionary_metadata_writer.rb +72 -0
- data/lib/clouds/metadata_writers/ruby_metadata_writer.rb +76 -0
- data/lib/clouds/metadata_writers/shell_metadata_writer.rb +121 -0
- data/lib/clouds/register_clouds.rb +34 -0
- data/lib/clouds.rb +32 -0
- data/lib/gem_dependencies.rb +83 -0
- data/lib/git_hooks/commit-msg.rb +7 -0
- data/lib/instance/agent_config.rb +168 -0
- data/lib/instance/agent_watcher.rb +233 -0
- data/lib/instance/audit_cook_stub.rb +104 -0
- data/lib/instance/audit_proxy.rb +247 -0
- data/lib/instance/bundle_queue.rb +104 -0
- data/lib/instance/cook/agent_connection.rb +109 -0
- data/lib/instance/cook/audit_logger.rb +165 -0
- data/lib/instance/cook/audit_stub.rb +142 -0
- data/lib/instance/cook/ca-bundle.crt +2794 -0
- data/lib/instance/cook/chef_state.rb +211 -0
- data/lib/instance/cook/cook.rb +306 -0
- data/lib/instance/cook/cook_state.rb +298 -0
- data/lib/instance/cook/cookbook_path_mapping.rb +66 -0
- data/lib/instance/cook/cookbook_repo_retriever.rb +190 -0
- data/lib/instance/cook/executable_sequence.rb +765 -0
- data/lib/instance/cook/external_parameter_gatherer.rb +190 -0
- data/lib/instance/cook/repose_downloader.rb +349 -0
- data/lib/instance/cook/shutdown_request_proxy.rb +121 -0
- data/lib/instance/cook.rb +41 -0
- data/lib/instance/downloader.rb +208 -0
- data/lib/instance/duplicable.rb +67 -0
- data/lib/instance/exceptions.rb +49 -0
- data/lib/instance/executable_sequence_proxy.rb +278 -0
- data/lib/instance/instance_commands.rb +577 -0
- data/lib/instance/instance_state.rb +633 -0
- data/lib/instance/json_utilities.rb +102 -0
- data/lib/instance/login_manager.rb +533 -0
- data/lib/instance/login_user_manager.rb +522 -0
- data/lib/instance/message_encoder.rb +118 -0
- data/lib/instance/multi_thread_bundle_queue.rb +232 -0
- data/lib/instance/operation_context.rb +60 -0
- data/lib/instance/options_bag.rb +65 -0
- data/lib/instance/payload_formatter.rb +46 -0
- data/lib/instance/policy.rb +53 -0
- data/lib/instance/policy_audit.rb +100 -0
- data/lib/instance/policy_manager.rb +146 -0
- data/lib/instance/reenroll_manager.rb +104 -0
- data/lib/instance/right_scripts_cookbook.rb +181 -0
- data/lib/instance/shutdown_request.rb +221 -0
- data/lib/instance/single_thread_bundle_queue.rb +189 -0
- data/lib/instance/volume_management.rb +450 -0
- data/lib/instance.rb +50 -0
- data/lib/repo_conf_generators/apt_conf_generators.rb +106 -0
- data/lib/repo_conf_generators/gem_conf_generators.rb +80 -0
- data/lib/repo_conf_generators/rightscale_conf_generators.rb +254 -0
- data/lib/repo_conf_generators/rightscale_key.pub +17 -0
- data/lib/repo_conf_generators/yum_conf_generators.rb +225 -0
- data/lib/repo_conf_generators.rb +30 -0
- data/lib/run_shell.rb +28 -0
- data/scripts/agent_checker.rb +571 -0
- data/scripts/agent_controller.rb +247 -0
- data/scripts/agent_deployer.rb +148 -0
- data/scripts/bundle_runner.rb +336 -0
- data/scripts/cloud_controller.rb +176 -0
- data/scripts/log_level_manager.rb +142 -0
- data/scripts/ohai_runner.rb +33 -0
- data/scripts/reenroller.rb +193 -0
- data/scripts/server_importer.rb +293 -0
- data/scripts/shutdown_client.rb +183 -0
- data/scripts/system_configurator.rb +367 -0
- data/scripts/tagger.rb +381 -0
- data/scripts/thunker.rb +356 -0
- metadata +418 -0
@@ -0,0 +1,80 @@
|
|
1
|
+
#
|
2
|
+
#
|
3
|
+
# Copyright (c) 2009-2011 RightScale Inc
|
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
|
+
module Gems
|
25
|
+
|
26
|
+
# Wrapper for the 'gem' command that ensures the systemwide config file is used.
|
27
|
+
#
|
28
|
+
#
|
29
|
+
# @param [String] command the gem command to run
|
30
|
+
# @param [optional, Array] *parameters glob of additional command-line parameters to pass to the RubyGems command
|
31
|
+
# @example gem('sources', '--list')
|
32
|
+
# @example gem('sources', '--add', 'http://awesome-gems.com')
|
33
|
+
def self.gem(command, *parameters)
|
34
|
+
res = `gem --config-file /etc/gemrc #{command} #{parameters.join(' ')}`
|
35
|
+
raise "Error #{RightScale::SubprocessFormatting.reason($?)} executing: `#{command}`: #{res}" unless $? == 0
|
36
|
+
res
|
37
|
+
end
|
38
|
+
|
39
|
+
module RubyGems #########################################################################
|
40
|
+
|
41
|
+
# The different generate classes will always generate an exception ("string") if there's anything that went wrong. If no exception, things went well.
|
42
|
+
def self.generate(description, base_urls, frozen_date="latest")
|
43
|
+
|
44
|
+
#1 - get the current sources
|
45
|
+
initial_sources= Gems.gem('sources', '--list').split("\n")
|
46
|
+
initial_sources.reject!{|s| s =~ /^\*\*\*/ || s.chomp == "" } # Discard the message (starting with ***) and empty lines returned by gem sources
|
47
|
+
|
48
|
+
#2- Add our sources
|
49
|
+
repo_path = "archive/"+ (frozen_date || "latest")
|
50
|
+
mirror_list = base_urls.map do |bu|
|
51
|
+
bu +='/' unless bu[-1..-1] == '/' # ensure the base url is terminated with a '/'
|
52
|
+
bu+repo_path+ ( repo_path[-1..-1] == '/'? "":"/")
|
53
|
+
end
|
54
|
+
sources_to_delete = initial_sources-mirror_list # remove good sources from later deletion if we're gonna add them right now.
|
55
|
+
mirror_list.map do |m|
|
56
|
+
begin
|
57
|
+
puts "Adding gem source: #{m}"
|
58
|
+
Gems.gem('sources', '--add', m)
|
59
|
+
rescue Exception => e
|
60
|
+
puts "Error Adding gem source #{m}: #{e}\n...continuing with others..."
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
#3-Delete the initial ones (that don't overlap with the new ones)
|
65
|
+
sources_to_delete.map do |m|
|
66
|
+
begin
|
67
|
+
puts "Removing stale gem source: #{m}"
|
68
|
+
Gems.gem('sources', '--remove', m)
|
69
|
+
rescue Exception => e
|
70
|
+
puts "Error Adding gem source #{m}: #{e}\n...continuing with others..."
|
71
|
+
end
|
72
|
+
end
|
73
|
+
mirror_list
|
74
|
+
end
|
75
|
+
end # Module RubyGems
|
76
|
+
|
77
|
+
end
|
78
|
+
|
79
|
+
# Examples of usage...
|
80
|
+
#Gems::RubyGems.generate("RubyGems description", ["http://a.com/rubygems","http://b.com/rubygems"], "20081010")
|
@@ -0,0 +1,254 @@
|
|
1
|
+
#
|
2
|
+
#
|
3
|
+
# Copyright (c) 2009-2011 RightScale Inc
|
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 'fileutils'
|
25
|
+
require 'date'
|
26
|
+
|
27
|
+
module Yum
|
28
|
+
BaseRepositoryDir="/etc/yum.repos.d" unless defined?(BaseRepositoryDir)
|
29
|
+
|
30
|
+
def self.execute(command)
|
31
|
+
res = `#{command}`
|
32
|
+
raise "Error #{RightScale::SubprocessFormatting.reason($?)} executing: `#{command}`: #{res}" unless $? == 0
|
33
|
+
res
|
34
|
+
end
|
35
|
+
|
36
|
+
module RightScale
|
37
|
+
module Epel #####################################################################
|
38
|
+
def self.generate(description, base_urls, frozen_date = "latest")
|
39
|
+
opts = {:repo_filename => "RightScale-epel",
|
40
|
+
:repo_name => "rightscale-epel",
|
41
|
+
:description => description,
|
42
|
+
:base_urls => base_urls,
|
43
|
+
:frozen_date => frozen_date,
|
44
|
+
:enabled => true }
|
45
|
+
opts[:frozen_date] = frozen_date || "latest" # Optional frozen date
|
46
|
+
Yum::RightScale::Epel::abstract_generate(opts)
|
47
|
+
end
|
48
|
+
module Testing #########################Epel-testing ###########################
|
49
|
+
def self.generate(description, base_urls, frozen_date = "latest")
|
50
|
+
opts = {:repo_filename => "RightScale-epel-testing",
|
51
|
+
:repo_name => "rightscale-epel-testing",
|
52
|
+
:description => description,
|
53
|
+
:base_urls => base_urls,
|
54
|
+
:frozen_date => frozen_date,
|
55
|
+
:enabled => true }
|
56
|
+
opts[:frozen_date] = frozen_date || "latest" # Optional frozen date
|
57
|
+
Yum::RightScale::Epel::abstract_generate(opts)
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
############## INTERNAL FUNCTIONS #######################################################
|
62
|
+
def self.abstract_generate(params)
|
63
|
+
return unless Yum::RightScale::Epel::yum_installed?
|
64
|
+
|
65
|
+
epel_version = get_enterprise_linux_version
|
66
|
+
puts "found EPEL version: #{epel_version}"
|
67
|
+
opts = { :enabled => true, :frozen_date => "latest"}
|
68
|
+
opts.merge!(params)
|
69
|
+
raise "missing parameters to generate file!" unless opts[:repo_filename] && opts[:repo_name] &&
|
70
|
+
opts[:base_urls] && opts[:frozen_date] && opts[:enabled]
|
71
|
+
|
72
|
+
arch = Yum::execute("uname -i").strip
|
73
|
+
|
74
|
+
repo_path = "#{epel_version}/#{arch}/archive/"+opts[:frozen_date]
|
75
|
+
mirror_list = opts[:base_urls].map do |bu|
|
76
|
+
bu +='/' unless bu[-1..-1] == '/' # ensure the base url is terminated with a '/'
|
77
|
+
bu+repo_path
|
78
|
+
end
|
79
|
+
|
80
|
+
gpgcheck = "1"
|
81
|
+
unless Yum::RightScale::Epel::rightscale_gpgkey_imported?
|
82
|
+
gpgfile = "/etc/pki/rpm-gpg/RPM-GPG-KEY-RightScale"
|
83
|
+
if File.exists?(gpgfile)
|
84
|
+
# This file should be installed by the rightimage cookbook
|
85
|
+
# starting with 12H1 (May 2012)
|
86
|
+
gpgkey = "file://#{gpgfile}"
|
87
|
+
gpgcheck = "1"
|
88
|
+
else
|
89
|
+
gpgfile = File.expand_path("../rightscale_key.pub", __FILE__)
|
90
|
+
Yum::execute("rpm --import #{gpgfile}")
|
91
|
+
gpgcheck = "1"
|
92
|
+
gpgkey = ""
|
93
|
+
end
|
94
|
+
end
|
95
|
+
config_body = <<END
|
96
|
+
[#{opts[:repo_name]}]
|
97
|
+
name = #{opts[:description]}
|
98
|
+
baseurl = #{mirror_list.join("\n ")}
|
99
|
+
failovermethod=priority
|
100
|
+
gpgcheck=#{gpgcheck}
|
101
|
+
enabled=#{(opts[:enabled] ? 1:0)}
|
102
|
+
gpgkey=#{gpgkey}
|
103
|
+
# set metadata to expire faster then main
|
104
|
+
metadata_expire=30
|
105
|
+
END
|
106
|
+
|
107
|
+
target_filename = "#{Yum::BaseRepositoryDir}/#{opts[:repo_filename]}.repo"
|
108
|
+
File.rename(target_filename,"#{Yum::BaseRepositoryDir}/.#{opts[:repo_filename]}.repo.#{`date +%Y%m%d%M%S`.strip}") if File.exists?("#{Yum::BaseRepositoryDir}/#{opts[:repo_filename]}.repo")
|
109
|
+
File.open(target_filename,'w') { |f| f.write(config_body) }
|
110
|
+
puts "Yum config file for Epel successfully generated in #{target_filename}"
|
111
|
+
mirror_list
|
112
|
+
end
|
113
|
+
|
114
|
+
def self.yum_installed?
|
115
|
+
if ::RightScale::Platform.linux? && (::RightScale::Platform.centos? || ::RightScale::Platform.rhel?)
|
116
|
+
true
|
117
|
+
else
|
118
|
+
false
|
119
|
+
end
|
120
|
+
end
|
121
|
+
|
122
|
+
def self.rightscale_gpgkey_imported?
|
123
|
+
begin
|
124
|
+
Yum::execute("rpm -qa gpg-pubkey --qf '%{summary}\n' | grep RightScale")
|
125
|
+
true
|
126
|
+
rescue
|
127
|
+
false
|
128
|
+
end
|
129
|
+
end
|
130
|
+
|
131
|
+
# Return the enterprise linux version of the running machine...or an exception if it's a non-enterprise version of linux.
|
132
|
+
# At this point we will only test for CentOS ... but in the future we can test RHEL, and any other compatible ones
|
133
|
+
# Note the version is a single (major) number.
|
134
|
+
def self.get_enterprise_linux_version
|
135
|
+
version=nil
|
136
|
+
if Yum::RightScale::Epel::yum_installed?
|
137
|
+
version = Yum::execute("lsb_release -rs").strip.split(".").first
|
138
|
+
else
|
139
|
+
raise "This doesn't appear to be an Enterprise Linux edition"
|
140
|
+
end
|
141
|
+
version
|
142
|
+
end
|
143
|
+
|
144
|
+
end
|
145
|
+
|
146
|
+
end
|
147
|
+
end
|
148
|
+
|
149
|
+
# Examples of usage...
|
150
|
+
#Yum::RightScale::Epel.generate("Epel description", ["http://a.com/epel","http://b.com/epel"], "20081010")
|
151
|
+
|
152
|
+
module Apt
|
153
|
+
|
154
|
+
def self.execute(command)
|
155
|
+
res = `#{command}`
|
156
|
+
raise "Error #{RightScale::SubprocessFormatting.reason($?)} executing: `#{command}`: #{res}" unless $? == 0
|
157
|
+
res
|
158
|
+
end
|
159
|
+
|
160
|
+
module RightScale
|
161
|
+
SUPPORTED_REPOS = ['lucid', 'precise']
|
162
|
+
|
163
|
+
# The different generate classes will always generate an exception ("string") if there's anything that went wrong. If no exception, things went well.
|
164
|
+
SUPPORTED_REPOS.each do |c|
|
165
|
+
module_eval <<-EOS
|
166
|
+
class #{c.capitalize}
|
167
|
+
def self.generate(description, base_urls, frozen_date="latest")
|
168
|
+
opts = { :repo_filename => "rightscale_extra",
|
169
|
+
:repo_name => "default",
|
170
|
+
:description => description,
|
171
|
+
:codename => '#{c}',
|
172
|
+
:base_urls => base_urls,
|
173
|
+
:frozen_date => frozen_date,
|
174
|
+
:enabled => true }
|
175
|
+
opts[:frozen_date] = frozen_date || "latest" # Optional frozen date
|
176
|
+
Apt::RightScale::abstract_generate(opts)
|
177
|
+
end
|
178
|
+
end
|
179
|
+
EOS
|
180
|
+
end
|
181
|
+
|
182
|
+
def self.path_to_sources_list
|
183
|
+
"/etc/apt/sources.list.d"
|
184
|
+
end
|
185
|
+
|
186
|
+
def self.rightscale_gpgkey_imported?
|
187
|
+
begin
|
188
|
+
Apt::execute("apt-key list | grep RightScale")
|
189
|
+
true
|
190
|
+
rescue
|
191
|
+
false
|
192
|
+
end
|
193
|
+
end
|
194
|
+
|
195
|
+
############## INTERNAL FUNCTIONS #######################################################
|
196
|
+
def self.abstract_generate(params)
|
197
|
+
return unless ::RightScale::Platform.linux? && ::RightScale::Platform.ubuntu?
|
198
|
+
|
199
|
+
opts = { :enabled => true, :frozen_date => "latest"}
|
200
|
+
opts.merge!(params)
|
201
|
+
raise ArgumentError.new("missing parameters to generate file!") unless opts[:repo_filename] &&
|
202
|
+
opts[:repo_name] &&
|
203
|
+
opts[:base_urls] &&
|
204
|
+
opts[:frozen_date] &&
|
205
|
+
opts[:enabled]
|
206
|
+
|
207
|
+
return unless opts[:enabled]
|
208
|
+
|
209
|
+
target = opts[:codename].downcase
|
210
|
+
codename = ::RightScale::Platform.codename.downcase
|
211
|
+
|
212
|
+
raise ::RightScale::Exceptions::PlatformError, "Unsupported Ubuntu release #{codename}" unless SUPPORTED_REPOS.include?(codename)
|
213
|
+
raise ::RightScale::Exceptions::PlatformError, "Wrong release; repo is for #{target}, we are #{codename}" unless target == codename
|
214
|
+
|
215
|
+
FileUtils.mkdir_p(Apt::RightScale::path_to_sources_list)
|
216
|
+
|
217
|
+
|
218
|
+
if opts[:frozen_date] != 'latest'
|
219
|
+
x = Date.parse(opts[:frozen_date]).to_s
|
220
|
+
x.gsub!(/-/,"/")
|
221
|
+
opts[:frozen_date] = x
|
222
|
+
end
|
223
|
+
|
224
|
+
mirror_list = opts[:base_urls].map do |bu|
|
225
|
+
bu +='/' unless bu[-1..-1] == '/' # ensure the base url is terminated with a '/'
|
226
|
+
bu + opts[:frozen_date]
|
227
|
+
end
|
228
|
+
config_body = ""
|
229
|
+
|
230
|
+
mirror_list.each do |mirror_url|
|
231
|
+
config_body += <<END
|
232
|
+
deb #{mirror_url} #{codename} main
|
233
|
+
|
234
|
+
END
|
235
|
+
end
|
236
|
+
|
237
|
+
target_filename = "#{Apt::RightScale::path_to_sources_list}/#{opts[:repo_filename]}.sources.list"
|
238
|
+
FileUtils.rm_f(target_filename) if File.exists?(target_filename)
|
239
|
+
File.open(target_filename,'w') { |f| f.write(config_body) }
|
240
|
+
FileUtils.mv("/etc/apt/sources.list", "/etc/apt/sources.list.ORIG") if File.exists?("/etc/apt/sources.list")
|
241
|
+
|
242
|
+
unless Apt::RightScale::rightscale_gpgkey_imported?
|
243
|
+
gpgfile = File.expand_path("../rightscale_key.pub", __FILE__)
|
244
|
+
Apt::execute("apt-key add #{gpgfile}")
|
245
|
+
end
|
246
|
+
|
247
|
+
mirror_list
|
248
|
+
end
|
249
|
+
end
|
250
|
+
end
|
251
|
+
|
252
|
+
|
253
|
+
# Examples of usage...
|
254
|
+
#Apt::RightScale::Lucid.generate("Lucid", [""http://a.com/rightscale_software_ubuntu""], "20081010")
|
@@ -0,0 +1,17 @@
|
|
1
|
+
-----BEGIN PGP PUBLIC KEY BLOCK-----
|
2
|
+
Version: GnuPG v1.4.5 (GNU/Linux)
|
3
|
+
|
4
|
+
mQGiBE7nCE4RBACAswemkJpR70ApTrD77UTxVdKl76C189L2AHrJviFZSl2NBgDo
|
5
|
+
q2F64e8iuBUwqdMrDOpXI4QyCorAe1MtXb5baU1RjW064rbh+m/+ffEe/yGUHWPp
|
6
|
+
oaq5PWphkKzkPPfSqC4F5eBgeUSLRsIwlCQ4CL3wvqOmBkSPSmv5hntyCwCg3Jak
|
7
|
+
A6oz9tw/XhiFZBQ1QNrK7BUD/jB3R9YKSjyxHna9Lr0hc5mDGc95KnLl2boMDDJu
|
8
|
+
nZNMuoz96ZDhsCVq6JuuFD4wHU5265kwguytX2TrGps5ACFrI/QLpjDLrNNn+3Al
|
9
|
+
1O7SvwuT25BFO+ypbeYnlBQsv363XGnnOYGza8t8iOWiukZj7JaLXedqcEoKl9ab
|
10
|
+
Cm8rA/9szm1m1Fk77OK/1NrX72T2MY7WpGjKgn4tdtvQq2FGR1wpOga+iv/U/QZr
|
11
|
+
oUlCILpaNX6svD1hLYVFmWD2iWwsTQXiBD5a6FD1UJ0lIG6z6fc6gbUcJ/8Q+Uyc
|
12
|
+
bGk4rHRW2OaWTuyNWGng7Zs2RlGi06H7b0cHSFHy6IFrdI2UFLQpUmlnaHRTY2Fs
|
13
|
+
ZSwgSW5jLiA8c3VwcG9ydEByaWdodHNjYWxlLmNvbT6IYgQTEQIAIgUCTucITgIb
|
14
|
+
AwYLCQgHAwIGFQgCCQoLBBYCAwECHgECF4AACgkQYvlgIJqRfQXJvACgiaEDudk3
|
15
|
+
y7vVHiqdnuqSp5EpRJoAoICIqrYXJ9ft/LCocDb9W666XDJB
|
16
|
+
=vQ9F
|
17
|
+
-----END PGP PUBLIC KEY BLOCK-----
|
@@ -0,0 +1,225 @@
|
|
1
|
+
#
|
2
|
+
#
|
3
|
+
# Copyright (c) 2009-2011 RightScale Inc
|
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
|
+
module Yum
|
25
|
+
BaseRepositoryDir="/etc/yum.repos.d" unless defined?(BaseRepositoryDir)
|
26
|
+
|
27
|
+
def self.execute(command)
|
28
|
+
res = `#{command}`
|
29
|
+
raise "Error #{RightScale::SubprocessFormatting.reason($?)} executing: `#{command}`: #{res}" unless $? == 0
|
30
|
+
res
|
31
|
+
end
|
32
|
+
|
33
|
+
module CentOS #########################################################################
|
34
|
+
RPM_GPG_KEY_CentOS5="file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5"
|
35
|
+
|
36
|
+
# The different generate classes will always generate an exception ("string") if there's anything that went wrong. If no exception, things went well.
|
37
|
+
class Base
|
38
|
+
def self.generate(description, base_urls, frozen_date="latest")
|
39
|
+
opts = {:repo_filename => "CentOS-Base",
|
40
|
+
:repo_name => "base",
|
41
|
+
:repo_subpath => "os",
|
42
|
+
:description => description,
|
43
|
+
:base_urls => base_urls,
|
44
|
+
:enabled => true }
|
45
|
+
opts[:frozen_date] = frozen_date || "latest" # Optional frozen date
|
46
|
+
Yum::CentOS::abstract_generate(opts)
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
class Updates
|
51
|
+
def self.generate(description, base_urls, frozen_date="latest")
|
52
|
+
opts = {:repo_filename => "CentOS-updates",
|
53
|
+
:repo_name => "updates",
|
54
|
+
:repo_subpath => "updates",
|
55
|
+
:description => description,
|
56
|
+
:base_urls => base_urls,
|
57
|
+
:frozen_date => frozen_date,
|
58
|
+
:enabled => true }
|
59
|
+
opts[:frozen_date] = frozen_date || "latest" # Optional frozen date
|
60
|
+
Yum::CentOS::abstract_generate(opts)
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
# The AddOns repository is used in CentOS 5 but not in 6+.
|
65
|
+
class AddOns
|
66
|
+
|
67
|
+
def self.generate(description, base_urls, frozen_date="latest")
|
68
|
+
# Support CentOS 6+ by NOT generating AddOns repo.
|
69
|
+
return unless Yum::CentOS::is_this_centos? && Yum::Epel::get_enterprise_linux_version.to_i < 6
|
70
|
+
|
71
|
+
opts = {:repo_filename => "CentOS-addons",
|
72
|
+
:repo_name => "addons",
|
73
|
+
:repo_subpath => "addons",
|
74
|
+
:description => description,
|
75
|
+
:base_urls => base_urls,
|
76
|
+
:frozen_date => frozen_date,
|
77
|
+
:enabled => true }
|
78
|
+
opts[:frozen_date] = frozen_date || "latest" # Optional frozen date
|
79
|
+
Yum::CentOS::abstract_generate(opts)
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
class Extras
|
84
|
+
def self.generate(description, base_urls, frozen_date="latest")
|
85
|
+
opts = {:repo_filename => "CentOS-extras",
|
86
|
+
:repo_name => "extras",
|
87
|
+
:repo_subpath => "extras",
|
88
|
+
:description => description,
|
89
|
+
:base_urls => base_urls,
|
90
|
+
:frozen_date => frozen_date,
|
91
|
+
:enabled => true }
|
92
|
+
opts[:frozen_date] = frozen_date || "latest" # Optional frozen date
|
93
|
+
Yum::CentOS::abstract_generate(opts)
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
97
|
+
class CentOSPlus
|
98
|
+
def self.generate(description, base_urls, frozen_date="latest")
|
99
|
+
opts = {:repo_filename => "CentOS-centosplus",
|
100
|
+
:repo_name => "centosplus",
|
101
|
+
:repo_subpath => "centosplus",
|
102
|
+
:description => description,
|
103
|
+
:base_urls => base_urls,
|
104
|
+
:frozen_date => frozen_date,
|
105
|
+
:enabled => true }
|
106
|
+
opts[:frozen_date] = frozen_date || "latest" # Optional frozen date
|
107
|
+
Yum::CentOS::abstract_generate(opts)
|
108
|
+
end
|
109
|
+
end
|
110
|
+
|
111
|
+
############## INTERNAL FUNCTIONS #######################################################
|
112
|
+
def self.abstract_generate(params)
|
113
|
+
return unless Yum::CentOS::is_this_centos?
|
114
|
+
opts = { :enabled => true, :gpgkey_file => RPM_GPG_KEY_CentOS5, :frozen_date => "latest"}
|
115
|
+
opts.merge!(params)
|
116
|
+
raise "missing parameters to generate file!" unless opts[:repo_filename] && opts[:repo_name] && opts[:repo_subpath] &&
|
117
|
+
opts[:base_urls] && opts[:frozen_date] && opts[:enabled] && opts[:gpgkey_file]
|
118
|
+
ver = Yum::execute("lsb_release -rs").strip
|
119
|
+
arch = Yum::execute("uname -i").strip
|
120
|
+
|
121
|
+
major_ver = ver.strip.split(".").first
|
122
|
+
repo_path = "#{major_ver}/#{opts[:repo_subpath]}/#{arch}"
|
123
|
+
|
124
|
+
# Old CentOS versions 5.0 and 5.1 were not versioned...so we just point to the base of the repo instead.
|
125
|
+
if !(ver =~ /5\.[01]/)
|
126
|
+
repo_path = repo_path + "/archive/" + opts[:frozen_date]
|
127
|
+
end
|
128
|
+
|
129
|
+
mirror_list = opts[:base_urls].map do |bu|
|
130
|
+
bu +='/' unless bu[-1..-1] == '/' # ensure the base url is terminated with a '/'
|
131
|
+
bu+repo_path
|
132
|
+
end
|
133
|
+
config_body = <<END
|
134
|
+
[#{opts[:repo_name]}]
|
135
|
+
name = #{opts[:description]}
|
136
|
+
baseurl = #{mirror_list.join("\n ")}
|
137
|
+
failovermethod=priority
|
138
|
+
gpgcheck=1
|
139
|
+
enabled=#{(opts[:enabled] ? 1:0)}
|
140
|
+
gpgkey=#{opts[:gpgkey_file]}
|
141
|
+
END
|
142
|
+
|
143
|
+
target_filename = "#{Yum::BaseRepositoryDir}/#{opts[:repo_filename]}.repo"
|
144
|
+
File.rename(target_filename,"#{Yum::BaseRepositoryDir}/.#{opts[:repo_filename]}.repo.#{`date +%Y%m%d%M%S`.strip}") if File.exists?("#{Yum::BaseRepositoryDir}/#{opts[:repo_filename]}.repo")
|
145
|
+
File.open(target_filename,'w') { |f| f.write(config_body) }
|
146
|
+
puts "Yum config file for CentOS successfully generated in #{target_filename}"
|
147
|
+
mirror_list
|
148
|
+
end
|
149
|
+
|
150
|
+
def self.is_this_centos?
|
151
|
+
return ::RightScale::Platform.linux? && ::RightScale::Platform.centos?
|
152
|
+
end
|
153
|
+
|
154
|
+
end # Module CentOS
|
155
|
+
|
156
|
+
module Epel #####################################################################
|
157
|
+
RPM_GPG_KEY_EPEL="file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL"
|
158
|
+
def self.generate(description, base_urls, frozen_date = "latest")
|
159
|
+
opts = {:repo_filename => "Epel",
|
160
|
+
:repo_name => "epel",
|
161
|
+
:description => description,
|
162
|
+
:base_urls => base_urls,
|
163
|
+
:frozen_date => frozen_date,
|
164
|
+
:enabled => true }
|
165
|
+
opts[:frozen_date] = frozen_date || "latest" # Optional frozen date
|
166
|
+
Yum::Epel::abstract_generate(opts)
|
167
|
+
end
|
168
|
+
############## INTERNAL FUNCTIONS #######################################################
|
169
|
+
def self.abstract_generate(params)
|
170
|
+
return unless Yum::CentOS::is_this_centos?
|
171
|
+
|
172
|
+
epel_version = get_enterprise_linux_version
|
173
|
+
puts "found EPEL version: #{epel_version}"
|
174
|
+
opts = { :enabled => true, :gpgkey_file => RPM_GPG_KEY_EPEL, :frozen_date => "latest"}
|
175
|
+
opts.merge!(params)
|
176
|
+
raise "missing parameters to generate file!" unless opts[:repo_filename] && opts[:repo_name] &&
|
177
|
+
opts[:base_urls] && opts[:frozen_date] && opts[:enabled] && opts[:gpgkey_file]
|
178
|
+
|
179
|
+
arch = Yum::execute("uname -i").strip
|
180
|
+
|
181
|
+
repo_path = "#{epel_version}/#{arch}/archive/"+opts[:frozen_date]
|
182
|
+
mirror_list = opts[:base_urls].map do |bu|
|
183
|
+
bu +='/' unless bu[-1..-1] == '/' # ensure the base url is terminated with a '/'
|
184
|
+
bu+repo_path
|
185
|
+
end
|
186
|
+
config_body = <<END
|
187
|
+
[#{opts[:repo_name]}]
|
188
|
+
name = #{opts[:description]}
|
189
|
+
baseurl = #{mirror_list.join("\n ")}
|
190
|
+
failovermethod=priority
|
191
|
+
gpgcheck=1
|
192
|
+
enabled=#{(opts[:enabled] ? 1:0)}
|
193
|
+
gpgkey=#{opts[:gpgkey_file]}
|
194
|
+
END
|
195
|
+
|
196
|
+
target_filename = "#{Yum::BaseRepositoryDir}/#{opts[:repo_filename]}.repo"
|
197
|
+
File.rename(target_filename,"#{Yum::BaseRepositoryDir}/.#{opts[:repo_filename]}.repo.#{`date +%Y%m%d%M%S`.strip}") if File.exists?("#{Yum::BaseRepositoryDir}/#{opts[:repo_filename]}.repo")
|
198
|
+
File.open(target_filename,'w') { |f| f.write(config_body) }
|
199
|
+
puts "Yum config file for Epel successfully generated in #{target_filename}"
|
200
|
+
mirror_list
|
201
|
+
end
|
202
|
+
|
203
|
+
# Return the enterprise linux version of the running machine...or an exception if it's a non-enterprise version of linux.
|
204
|
+
# At this point we will only test for CentOS ... but in the future we can test RHEL, and any other compatible ones
|
205
|
+
# Note the version is a single (major) number.
|
206
|
+
def self.get_enterprise_linux_version
|
207
|
+
version=nil
|
208
|
+
if Yum::CentOS::is_this_centos?
|
209
|
+
version = Yum::execute("lsb_release -rs").strip.split(".").first
|
210
|
+
else
|
211
|
+
raise "This doesn't appear to be an Enterprise Linux edition"
|
212
|
+
end
|
213
|
+
version
|
214
|
+
end
|
215
|
+
end
|
216
|
+
|
217
|
+
end
|
218
|
+
|
219
|
+
# Examples of usage...
|
220
|
+
#Yum::CentOS::Base.generate("Centos base description", ["http://a.com/centos","http://b.com/centos"], "20081010")
|
221
|
+
#Yum::CentOS::AddOns.generate("Centos addons description", ["http://a.com/centos","http://b.com/centos"], "latest")
|
222
|
+
#Yum::CentOS::Updates.generate("Centos updates description", ["http://a.com/centos","http://b.com/centos"], ) # Nil also means not frozen (i.e., equivalent to latest)
|
223
|
+
#Yum::CentOS::Extras.generate("Centos extras description", ["http://a.com/centos","http://b.com/centos"], "latest")
|
224
|
+
#Yum::CentOS::CentOSPlus.generate("Centos centosplus description", ["http://a.com/centos","http://b.com/centos"], "latest")
|
225
|
+
#Yum::Epel.generate("Epel description", ["http://a.com/epel","http://b.com/epel"], "20081010")
|
@@ -0,0 +1,30 @@
|
|
1
|
+
#
|
2
|
+
#
|
3
|
+
# Copyright (c) 2009-2011 RightScale Inc
|
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
|
+
REPO_CONF_GENERATORS_BASE_DIR = File.join(File.dirname(__FILE__), 'repo_conf_generators')
|
25
|
+
|
26
|
+
require File.normalize_path(File.join(REPO_CONF_GENERATORS_BASE_DIR, 'yum_conf_generators.rb'))
|
27
|
+
require File.normalize_path(File.join(REPO_CONF_GENERATORS_BASE_DIR, 'gem_conf_generators.rb'))
|
28
|
+
require File.normalize_path(File.join(REPO_CONF_GENERATORS_BASE_DIR, 'rightscale_conf_generators.rb'))
|
29
|
+
require File.normalize_path(File.join(REPO_CONF_GENERATORS_BASE_DIR, 'apt_conf_generators.rb'))
|
30
|
+
|
data/lib/run_shell.rb
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
module RunShell
|
2
|
+
|
3
|
+
# Runs a shell command and pipes output to console.
|
4
|
+
def runshell(cmd, ignoreerrors=false)
|
5
|
+
puts "+ #{cmd}"
|
6
|
+
IO.popen("#{cmd} 2>&1", 'r') do |output|
|
7
|
+
output.sync = true
|
8
|
+
done = false
|
9
|
+
while !done
|
10
|
+
begin
|
11
|
+
puts output.readline
|
12
|
+
rescue EOFError
|
13
|
+
done = true
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
exitstatus = $?.exitstatus
|
19
|
+
fail "SHELL COMMAND FAILED - exit code #{exitstatus}" unless (ignoreerrors || $?.success?)
|
20
|
+
return exitstatus
|
21
|
+
end
|
22
|
+
|
23
|
+
# for Windows-specific tasks.
|
24
|
+
def is_windows?
|
25
|
+
return !!(RUBY_PLATFORM =~ /mswin/)
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|