Skip to content

Commit

Permalink
Merge branch 'master' of git://git.fedorahosted.org/git/aeolus/configure
Browse files Browse the repository at this point in the history
  • Loading branch information
jguiditta committed Sep 26, 2011
2 parents e8e2022 + ff33f9b commit 5044e56
Show file tree
Hide file tree
Showing 14 changed files with 110 additions and 63 deletions.
19 changes: 2 additions & 17 deletions bin/aeolus-check-services
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.

init_scripts=%w(mongod iwhd postgresql httpd qpidd deltacloud-core libvirtd condor aeolus-conductor conductor-dbomatic imagefactory ntpd)
# ordered as in rc.d
init_scripts=%w(mongod iwhd postgresql httpd qpidd deltacloud-core libvirtd aeolus-conductor conductor-dbomatic imagefactory ntpd)

init_scripts.each do |script|
puts "\nChecking #{script} ..."
Expand All @@ -26,19 +27,3 @@ init_scripts.each do |script|
puts " \e[1;31mFAILURE:\e[0m #{out.strip}"
end
end

# Other checks
commands = [
{:name => 'condor_q', :command => 'condor_q'},
{:name => 'condor_status', :command => 'condor_status'}
]
commands.each do |cmd|
puts "\nChecking #{cmd[:name]} ..."
cmd = "#{cmd[:command]}"
out = `#{cmd}`
if $?.to_i == 0
puts " \e[1;32mSuccess:\e[0m #{out.strip}"
else
puts " \e[1;31mFAILURE:\e[0m #{out.strip}"
end
end
2 changes: 1 addition & 1 deletion bin/aeolus-cleanup
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export FACTER_AEOLUS_ENABLE_HTTPS=true
export FACTER_AEOLUS_ENABLE_SECURITY=false
puppet /usr/share/aeolus-configure/modules/aeolus/aeolus.pp \
--modulepath=/usr/share/aeolus-configure/modules/ \
--external_nodes "/usr/sbin/aeolus-node $PUPPET_NODE" --node_terminus exec \
--external_nodes "/bin/sh /usr/share/aeolus-configure/modules/aeolus/aeolus-node $PUPPET_NODE" --node_terminus exec \
--logdest=/var/log/aeolus-configure/aeolus-cleanup.log \
--logdest=console \
$LOGLEVEL
2 changes: 1 addition & 1 deletion bin/aeolus-configure
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ export FACTER_AEOLUS_ENABLE_HTTPS=true
export FACTER_AEOLUS_ENABLE_SECURITY=false
puppet /usr/share/aeolus-configure/modules/aeolus/aeolus.pp \
--modulepath=/usr/share/aeolus-configure/modules/ \
--external_nodes "/usr/sbin/aeolus-node $PUPPET_NODE" --node_terminus exec \
--external_nodes "/bin/sh /usr/share/aeolus-configure/modules/aeolus/aeolus-node $PUPPET_NODE" --node_terminus exec \
--logdest=/var/log/aeolus-configure/aeolus-configure.log \
--logdest=console \
$LOGLEVEL
Empty file modified bin/aeolus-node
100644 → 100755
Empty file.
17 changes: 1 addition & 16 deletions bin/aeolus-restart-services
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
# limitations under the License.

# ordered as in rc.d
services = %w(mongod iwhd postgresql httpd qpidd deltacloud-core libvirtd condor aeolus-conductor conductor-dbomatic imagefactory)
services = %w(mongod iwhd postgresql httpd qpidd deltacloud-core libvirtd aeolus-conductor conductor-dbomatic imagefactory ntpd)

def perform(action, svcs)
action = action.to_s
Expand All @@ -36,21 +36,6 @@ perform :stop, services.reverse
perform :start, services

## Other checks
commands = [
{:name => 'condor_q', :command => 'condor_q'},
{:name => 'condor_status', :command => 'condor_status'}
]

commands.each do |cmd|
puts "\nChecking #{cmd[:name]} ..."
cmd = "#{cmd[:command]}"
out = `#{cmd}`
if $?.to_i == 0
puts " \e[1;32mSuccess:\e[0m #{out.strip}"
else
puts " \e[1;31mFAILURE:\e[0m #{out.strip}"
end
end

if perform(:status, ['mongod']) == [1]
lockfile = '/var/lib/mongodb/mongod.lock'
Expand Down
86 changes: 86 additions & 0 deletions bin/cloud.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
#!/usr/bin/ruby
# setup repositories, download/install aeolus, run interactive config, bring up wui
# must be run as the super user
# TODO other distro support

require 'optparse'

Signal.trap("INT") do
puts ""
exit 1
end

colors = {:reset => "\e[0m",
:bold => "\e[1m",
:black => "\e[30m",
:red => "\e[31m",
:blue => "\e[34m",
:green => "\e[32m"}

puts "#{colors[:bold]}To The Cloud!....#{colors[:reset]}"

options = {:deploy => false,
:migrate => false,
:scale => false}

optparse = OptionParser.new do |opts|
opts.banner = "#{colors[:bold]}Usage: cloud.rb [options]"
opts.on("-d", "--deploy", "Deploy new instances to the cloud") { options[:deploy] = true }
opts.on("-m", "--migrate", "Migrate existing instances from one cloud provider to another") { options[:migrate] = true }
opts.on("-s", "--scale", "Scale existing instances accross cloud providers") { options[:scale] = true }
opts.on("-h", "--help", 'Display this message' ) { puts opts ; exit 0 }
end

optparse.parse!

options[:deploy] = true unless options.values.include? true

####################
puts "#{colors[:blue]}setting up repositories..."

FEDORA="14"

REPOS={:testing => "http://repos.fedorapeople.org/repos/aeolus/conductor/testing/fedora-$releasever/$basearch/",
:expiremental => "http://yum.morsi.org/aeolus/",
:deltacloud => "http://devel.mifo.sk/deltacloud/current/$basearch"}

File.open("/etc/yum.repos.d/aeolus.repo", "w"){ |f|
REPOS.each { |n,r|
repo = "[aeolus_#{n}]\n" +
"name=aeolus_#{n}\n" +
"baseurl=#{r}\n" +
"enabled=1\n" +
"skip_if_unavailable=1\n" +
"gpgcheck=0\n"
f.write repo
puts "Created aeolus_#{n}"
}
}

puts "#{colors[:green]}Done\n\n"

#####################
puts "#{colors[:blue]}installing packages............"

IO.popen("yum install deltacloud-core-all aeolus-all -y") do |p|
while l = p.gets do
puts l
end
end

puts "#{colors[:green]}Done\n\n"

#####################
puts "#{colors[:blue]}launching configure............"

# just fork/exec here to handle stdin
fork{
exec "/usr/sbin/aeolus-configure -i #{options.collect { |o| "--#{o}" }.join(" ")}"
}
Process.wait

puts "#{colors[:green]}Done\n\n"

# TODO open up web browser to conductor

puts "#{colors[:reset]}"
3 changes: 1 addition & 2 deletions contrib/aeolus-configure.spec
Original file line number Diff line number Diff line change
Expand Up @@ -46,18 +46,17 @@ Aeolus Configure Puppet Recipe
%{__cp} -R %{pbuild}/recipes/ntp/ %{buildroot}/%{aeolushome}/modules/ntp
%{__cp} -R %{pbuild}/recipes/openssl/ %{buildroot}/%{aeolushome}/modules/openssl
%{__cp} -R %{pbuild}/recipes/postgres/ %{buildroot}/%{aeolushome}/modules/postgres
%{__cp} -R %{pbuild}/bin/aeolus-node %{buildroot}/%{aeolushome}/modules/aeolus/
%{__cp} -R %{pbuild}/bin/aeolus-check-services %{buildroot}/%{_bindir}/
%{__cp} -R %{pbuild}/bin/aeolus-restart-services %{buildroot}/%{_sbindir}/
%{__cp} -R %{pbuild}/bin/aeolus-configure-image %{buildroot}/%{_sbindir}/
%{__cp} -R %{pbuild}/bin/aeolus-configure %{buildroot}/%{_sbindir}/
%{__cp} -R %{pbuild}/bin/aeolus-cleanup %{buildroot}/%{_sbindir}/
%{__cp} -R %{pbuild}/bin/aeolus-node %{buildroot}/%{_sbindir}/

%files
%doc COPYING
%attr(0755, root, root) %{_sbindir}/aeolus-configure
%attr(0755, root, root) %{_sbindir}/aeolus-cleanup
%attr(0755, root, root) %{_sbindir}/aeolus-node
%config(noreplace) %{_sysconfdir}/aeolus-configure/*
%attr(0755, root, root) %{_bindir}/aeolus-check-services
%attr(0755, root, root) %{_sbindir}/aeolus-restart-services
Expand Down
5 changes: 1 addition & 4 deletions recipes/aeolus/cli.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def clear_screen
PROFILE_RECIPE='/usr/share/aeolus-configure/modules/aeolus/manifests/profiles/custom.pp'

installed_component = nil
install_components = []
install_components = ["- aeolus::conductor"]
while ![:None, :All].include?(installed_component)
clear_screen
say "Select Aeolus Components to Install"
Expand All @@ -45,14 +45,11 @@ def clear_screen
menu.choice :None
menu.choice :"Image Factory"
menu.choice :"Image Warehouse"
menu.choice :"Conductor"
end
if installed_component == :"Image Factory"
install_components << "- aeolus::image-factory"
elsif installed_component == :"Image Warehouse"
install_components << "- aeolus::iwhd"
elsif installed_component == :"Conductor"
install_components << "- aeolus::conductor"
elsif installed_component == :All
install_components << "- aeolus::conductor" <<
"- aeolus::image-factory" <<
Expand Down
21 changes: 2 additions & 19 deletions recipes/aeolus/manifests/conductor.pp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
# specific versions of these two packages are needed and we need to pull the third in
package {['aeolus-conductor',
'aeolus-conductor-daemons',
'condor',
'aeolus-all']:
ensure => 'installed',
provider => $package_provider }
Expand All @@ -33,22 +32,6 @@
### Setup selinux for deltacloud
selinux::mode{"permissive":}

### Start the aeolus services
file {"/etc/condor/config.d/10deltacloud.config":
source => "puppet:///modules/aeolus/condor_config.local",
require => Package['aeolus-conductor-daemons', 'condor'] }
# condor requires an explicit non-localhost hostname
# TODO we can also kill the configure sequence here instead
exec{"/bin/echo 'hostname/domain should be explicitly set and should not be localhost.localdomain'":
logoutput => true,
onlyif => "/usr/bin/test `/bin/hostname` = 'localhost.localdomain'"
}
service { ['condor']:
ensure => 'running',
enable => true,
hasstatus => true,
require => File['/etc/condor/config.d/10deltacloud.config'] }

### Setup apache for deltacloud
include apache
if $enable_https {
Expand All @@ -64,7 +47,7 @@
hasstatus => true,
require => [Package['aeolus-conductor-daemons'],
Rails::Migrate::Db[migrate_aeolus_database],
Service['condor', 'httpd'],
Service['httpd'],
Apache::Site[aeolus-conductor], Exec[reload-apache]] }

### Initialize and start the aeolus database
Expand Down Expand Up @@ -137,7 +120,7 @@
}

### Stop the aeolus services
service { ['condor', 'httpd']:
service { ['httpd']:
ensure => 'stopped',
enable => false,
require => Service['aeolus-conductor',
Expand Down
7 changes: 7 additions & 0 deletions recipes/aeolus/manifests/deltacloud.pp
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,11 @@
ensure => 'stopped',
enable => false,
hasstatus => true}

# remove deprecated services
file { '/etc/init.d/deltacloud-ec2-us-east-1': ensure => 'absent' }
file { '/etc/init.d/deltacloud-ec2-us-west-1': ensure => 'absent' }
file { '/etc/init.d/deltacloud-mock': ensure => 'absent' }
file { '/etc/init.d/deltacloud-rhevm': ensure => 'absent' }
file { '/etc/init.d/deltacloud-vsphere': ensure => 'absent' }
}
4 changes: 2 additions & 2 deletions recipes/aeolus/manifests/profiles/rhevm.pp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
# limitations under the License.

class aeolus::profiles::rhevm {
file {"/etc/rhevm.json":
file {"/etc/imagefactory/rhevm.json":
content => template("aeolus/rhevm.json"),
mode => 755,
require => Package['aeolus-conductor-daemons'] }
Expand All @@ -38,7 +38,7 @@
exec { "/sbin/service iwhd restart":
require => [Service['iwhd'],
Mount["$rhevm_nfs_mount_point"],
File["/etc/rhevm.json"],
File["/etc/imagefactory/rhevm.json"],
File["/etc/iwhd/conf.js"]]}

aeolus::create_bucket{"aeolus":}
Expand Down
5 changes: 5 additions & 0 deletions recipes/aeolus/manifests/profiles/vsphere.pp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@
class aeolus::profiles::vsphere {
aeolus::create_bucket{"aeolus":}

file {"/etc/imagefactory/vsphere.json":
content => template("aeolus/vsphere.json"),
mode => 755,
require => Package['aeolus-conductor-daemons'] }

aeolus::conductor::site_admin{"admin":
email => '[email protected]',
password => "password",
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
'appliance-tools', 'livecd-tools', 'python-imgcreate']

# TODO want to include httpd, qpidd here as well but that requires elevated permissions
AEOLUS_DEPENDENCY_SERVICES = ['mongod', 'condor', 'sshd', 'postgresql']
AEOLUS_DEPENDENCY_SERVICES = ['mongod', 'sshd', 'postgresql']

IWHD_URI='http://localhost:9090/'

Expand Down

0 comments on commit 5044e56

Please sign in to comment.