[PATCH aeolus-configure] BZ827562 - Upgrade from CloudForms 1.0 to CloudForms 1.0.1 requires additional data definition not provided by rails migration
Steve Linabery
slinaber at redhat.com
Fri Jun 1 21:08:33 UTC 2012
On Fri, Jun 01, 2012 at 04:56:45PM -0400, John Eckersberg wrote:
> On Fri, 1 Jun 2012 15:37:13 -0500, Steve Linabery <slinaber at redhat.com> wrote:
> > We need a script to stop,start,restart aeolus services so that we
> > can stop them, insert data required by upgrade path, and restart.
> > The existing aeolus-services script appears deprecated and is used
> > nowhere else in the codebase for aeolus-configure or aeolus-conductor,
> > so we'll refactor it to be useful for this purpose.
> > ---
> > bin/aeolus-services | 74 +++++++++++++++++++++++++++++++++++++++++++++++---
> > 1 files changed, 69 insertions(+), 5 deletions(-)
> > mode change 100644 => 100755 bin/aeolus-services
> >
> > diff --git a/bin/aeolus-services b/bin/aeolus-services
> > old mode 100644
> > new mode 100755
> > index 76dbc5d..2becbfd
> > --- a/bin/aeolus-services
> > +++ b/bin/aeolus-services
> > @@ -1,4 +1,4 @@
> > -#!/bin/sh
> > +#!/usr/bin/env ruby
> >
> > # Copyright 2011 Red Hat, Inc.
> > #
> > @@ -14,7 +14,71 @@
> > # See the License for the specific language governing permissions and
> > # limitations under the License.
> >
> > -puppet /usr/share/aeolus-configure/aeolus_stop_services.pp \
> > - --modulepath=/usr/share/aeolus-configure/modules/ \
> > - --logdest=/var/log/aeolus-configure/aeolus-services.log \
> > - --logdest=console
> > +if ARGV.include?('-h') || ARGV.include?('--help')
> > + puts "Usage: #{$0} stop|start|restart
> > +Stop, Start, or Restart Aeolus services.
> > +
> > + -h, --help display this help and exit
> > +
> > +To show status of aeolus services please use aeolus-check-services.
> > +"
> > + exit
> > +end
> > +
> > +if !['stop','start','restart'].include?(ARGV[0])
> > + puts "Usage: #{$0} stop|start|restart
> > +Stop, Start, or Restart Aeolus services.
> > +
> > +To show status of aeolus services please use aeolus-check-services.
> > +"
> > + exit(1)
> > +end
> > +
> > +# ordered as in rc.d
> > +$services = %w(mongod iwhd postgresql httpd deltacloud-core libvirtd aeolus-conductor conductor-dbomatic imagefactory ntpd)
> > +
> > +def perform(action, svcs)
> > + action = action.to_s
> > + svcs.map do |script|
> > + puts "\n#{action.capitalize}ing #{script} ..."
> > + cmd = "service #{script} #{action}"
> > + out = `#{cmd}`
> > + if $?.to_i == 0
> > + puts " \e[1;32mSuccess:\e[0m #{out.strip}"
> > + else
> > + puts " \e[1;31mFAILURE:\e[0m #{out.strip}"
> > + end
> > + $?.to_i
> > + end
> > +end
> > +
> > +def mongod_cleanup_and_restart
> > + if perform(:status, ['mongod']) == [1]
> > + lockfile = '/var/lib/mongodb/mongod.lock'
> > + if File.exists?(lockfile)
> > + puts " \e[1;33mremoving\e[0m leftover #{lockfile}"
> > + File.delete(lockfile)
> > + perform :restart, %w(mongod iwhd)
> > + end
> > + end
> > +end
> > +
> > +def start
> > + perform :start, $services
> > + mongod_cleanup_and_restart
> > +end
> > +
> > +def stop
> > + perform :stop, $services.reverse
> > +end
> > +
> > +def restart
> > + stop
> > + start
> > +end
> > +
> > +case ARGV[0]
> > + when "start" then start
> > + when "stop" then stop
> > + when "restart" then restart
> > +end
> > --
> > 1.7.6.5
> >
>
> Conditional ACK, works as advertised. Make sure this gets added to the
> spec file; here's a patch for that.
>
> diff --git a/contrib/aeolus-configure.spec.in b/contrib/aeolus-configure.spec.in
> index 22ba7b6..3432c91 100644
> --- a/contrib/aeolus-configure.spec.in
> +++ b/contrib/aeolus-configure.spec.in
> @@ -51,6 +51,7 @@ Aeolus Configure Puppet Recipe
> %{__cp} -R %{pbuild}/bin/aeolus-node-check %{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-services %{buildroot}/%{_sbindir}/
> %{__cp} -R %{pbuild}/bin/aeolus-configure %{buildroot}/%{_sbindir}/
> %{__cp} -R %{pbuild}/bin/aeolus-cleanup %{buildroot}/%{_sbindir}/
> %{__cp} %{pbuild}/docs/man1/* %{buildroot}/%{_mandir}/man1/
> @@ -63,6 +64,7 @@ Aeolus Configure Puppet Recipe
> %attr(0600, root, root) %{_sysconfdir}/aeolus-configure/nodes/*
> %attr(0755, root, root) %{_bindir}/aeolus-check-services
> %attr(0755, root, root) %{_sbindir}/aeolus-restart-services
> +%attr(0755, root, root) %{_sbindir}/aeolus-services
> %doc %{_mandir}/man1/*
> %{aeolushome}
>
good catch re: spec, thank you.
adding, pushing.
s|e
More information about the aeolus-devel
mailing list