← Back to team overview

rapache-devel team mailing list archive

[Merge] lp:~alfred-maghi/rapache/rapache-ubuntu10.04 into lp:rapache

 

Alfred Maghi has proposed merging lp:~alfred-maghi/rapache/rapache-ubuntu10.04 into lp:rapache.

Requested reviews:
  Rapache Developers (rapache-devel)


fix start/stop/restart-apache feature, fix location of glade files and icon.
-- 
https://code.launchpad.net/~alfred-maghi/rapache/rapache-ubuntu10.04/+merge/25699
Your team Rapache Developers is requested to review the proposed merge of lp:~alfred-maghi/rapache/rapache-ubuntu10.04 into lp:rapache.
=== modified file 'AUTHORS'
--- AUTHORS	2008-09-15 02:30:54 +0000
+++ AUTHORS	2010-05-20 16:23:24 +0000
@@ -16,6 +16,7 @@
 
 Rapache Developers Team:
 
+ * Alfred Maghi <alfred.maghi@xxxxxxxxx>
  * Stefano Forenza <tacone@xxxxxxxxx>
  * Emanuele Gentili <emgent@xxxxxxxxxx>
  * Damiano Di Carlo <damianodicarlo@xxxxxxxxx>

=== modified file 'Glade/main.glade'
--- Glade/main.glade	2008-09-15 04:55:10 +0000
+++ Glade/main.glade	2010-05-20 16:23:24 +0000
@@ -105,7 +105,7 @@
                         <property name="visible">True</property>
                         <property name="label" translatable="yes">_Start Apache</property>
                         <property name="use_underline">True</property>
-                        <signal name="activate" handler="please_restart"/>
+                        <signal name="activate" handler="please_start"/>
                         <child internal-child="image">
                           <widget class="GtkImage" id="menu-item-image7">
                             <property name="stock">gtk-media-play</property>

=== modified file 'RapacheCore/Apache.py'
--- RapacheCore/Apache.py	2008-09-15 04:16:47 +0000
+++ RapacheCore/Apache.py	2010-05-20 16:23:24 +0000
@@ -40,16 +40,22 @@
             return False
 
     def start(self):
-        Shell.command.sudo_execute(["apache2ctl", "start"])
+        Shell.command.gksudo(
+			"gksudo service apache2 start",
+                	"Apache http server will be started with the command:")
         return
         
     def stop(self):
-        #Shell.command.sudo_execute(["apache2ctl", "-k", "graceful"])
-        Shell.command.sudo_execute(["apache2ctl", "stop"])
+        Shell.command.gksudo(
+			"gksudo service apache2 stop",
+			"Apache http server will be stopped with the command:",
+			"warning")
         return
        
     def restart(self):
-        Shell.command.sudo_execute(["apache2ctl", "graceful"])
+        Shell.command.gksudo(
+			"gksudo service apache2 restart",
+			"Apache http server will be restarted with the command:")
         return
         
     def test_config(self):

=== modified file 'RapacheCore/Shell.py'
--- RapacheCore/Shell.py	2008-09-08 00:18:34 +0000
+++ RapacheCore/Shell.py	2010-05-20 16:23:24 +0000
@@ -43,6 +43,7 @@
 import glob
 import operator
 import Configuration
+import gtk
 
 class CommandLogEntry:
 
@@ -289,6 +290,26 @@
     def ask_password(self, description = "Super user priviledges are required to perform this operation"):
         res = self.sudo_execute( ['echo'],  description = "Super user priviledges are required to perform this operation" )
         return res[0] == 0
+		       
+    # gksudo is used to start/stop apache and mysql services
+    def gksudo(self, cmd, comment, msg = "info"):
+		if (msg=="info"):
+
+			dialog = gtk.MessageDialog(None,
+	                gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT,
+                	gtk.MESSAGE_INFO, gtk.BUTTONS_OK,
+	                comment+"\n\n"+cmd[2:])
+
+		else:
+			dialog = gtk.MessageDialog(None,
+	                gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT,
+			gtk.MESSAGE_WARNING, gtk.BUTTONS_OK,
+        	        comment+"\n\n"+cmd[2:])
+
+                dialog.run()
+                os.system(cmd)
+                dialog.destroy()
+
     def sudo_execute(self, command, description = "Super user priviledges are required to perform this operation"):
         #log = CommandLogEntry(command)
         #self.command_log.append( log )

=== modified file 'RapacheGtk/RapacheGui.py'
--- RapacheGtk/RapacheGui.py	2008-09-15 06:53:55 +0000
+++ RapacheGtk/RapacheGui.py	2010-05-20 16:23:24 +0000
@@ -86,8 +86,9 @@
         self.xml = gtk.glade.XML(self.gladefile)         
         #Create our dictionary and connect it
         dic = { "new_button_clicked" : self.new_button_clicked,
-            "on_MainWindow_destroy" : self.quit ,
-            "please_restart" : self.restart_apache ,            
+            "on_MainWindow_destroy" : self.quit,
+            "please_start" : self.start_apache,            
+            "please_restart" : self.restart_apache,            
             "on_delete" : self.delete_button_clicked,
             "edit_button_clicked" : self.edit_button_clicked,
             "edit_module_button_clicked" : self.edit_module_button_clicked,
@@ -389,16 +390,22 @@
         self.refresh_vhosts()
         self.refresh_modules()
         self.refresh_config_test(focus_error)
-        
+
+    def start_apache ( self, widget ):
+        print "Starting apache on user's request"
+        self.apache.start()
+        self.update_server_status()
+        self.xml.get_widget( 'restart_apache_notice' ).show()
+
     def please_restart ( self ):
         self.xml.get_widget( 'restart_apache_notice' ).show()
     def restart_apache ( self, widget ):
-        if not Shell.command.ask_password(): return
+        #if not Shell.command.ask_password(): return  # Not usefull: password is handle by gksudo
         print "Restarting apache on user's request"
         self.apache.restart()
         self.update_server_status()
         self.xml.get_widget( 'restart_apache_notice' ).hide()
-        self.refresh_lists(True)
+        #self.refresh_lists(True)  # FIXME
         
     def is_vhost_editable (self, name):
         return name != 'default'

=== modified file 'setup.py'
--- setup.py	2008-09-16 14:00:49 +0000
+++ setup.py	2010-05-20 16:23:24 +0000
@@ -21,22 +21,23 @@
 from distutils.core import setup
 setup(
     name='rapache',
+    version='0.7',
     author='Rapache Developers',
     author_email='rapache-devel@xxxxxxxxxxxxxxxxxxx',
     maintainer='Emanuele Gentili',
     maintainer_email='emgent@xxxxxxxxxx',
     description='Simple tool for managing and configuring an apache2 instance',
-    url = 'http://www.rapache.org',
+    url = 'http://launchpad.net/rapache',
     license='GNU GPL',
     packages=['RapacheCore', 'RapacheGtk'],
     scripts=['rapache', 'hosts-manager'],
     data_files=[
-                ('share/rapache/Glade', glob.glob('Glade/*')),
+                ('/usr/share/rapache/Glade', glob.glob('Glade/*')),
                 ('lib/rapache/plugins/', glob.glob('plugins/__init__.py')),
                 ('lib/rapache/plugins/ssl', glob.glob('plugins/ssl/*')),
                 ('lib/rapache/plugins/advanced', glob.glob('plugins/advanced/*')),
                 ('lib/rapache/plugins/basic_authentication', glob.glob('plugins/basic_authentication/*')),
-                ('share/applications', ['data/rapache.desktop']),
+                ('/usr/share/applications', ['data/rapache.desktop']),
                ],
     )