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

Proposed by Alfred Maghi on 2010-05-20
Status: Needs review
Proposed branch: lp:~alfred-maghi/rapache/rapache-ubuntu10.04
Merge into: lp:rapache
Diff against target: 166 lines (+49/-13)
6 files modified
AUTHORS (+1/-0)
Glade/main.glade (+1/-1)
RapacheCore/Apache.py (+10/-4)
RapacheCore/Shell.py (+21/-0)
RapacheGtk/RapacheGui.py (+12/-5)
setup.py (+4/-3)
To merge this branch: bzr merge lp:~alfred-maghi/rapache/rapache-ubuntu10.04
Reviewer Review Type Date Requested Status
Rapache Developers 2010-05-20 Pending
Review via email: mp+25699@code.launchpad.net

Description of the change

fix start/stop/restart-apache feature, fix location of glade files and icon.

To post a comment you must log in.

Unmerged revisions

95. By Alfred Maghi on 2010-05-20

fix start/stop/restart-apache feature, fix location of glade files and icon.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'AUTHORS'
2--- AUTHORS 2008-09-15 02:30:54 +0000
3+++ AUTHORS 2010-05-20 16:23:24 +0000
4@@ -16,6 +16,7 @@
5
6 Rapache Developers Team:
7
8+ * Alfred Maghi <alfred.maghi@gmail.com>
9 * Stefano Forenza <tacone@gmail.com>
10 * Emanuele Gentili <emgent@ubuntu.com>
11 * Damiano Di Carlo <damianodicarlo@gmail.com>
12
13=== modified file 'Glade/main.glade'
14--- Glade/main.glade 2008-09-15 04:55:10 +0000
15+++ Glade/main.glade 2010-05-20 16:23:24 +0000
16@@ -105,7 +105,7 @@
17 <property name="visible">True</property>
18 <property name="label" translatable="yes">_Start Apache</property>
19 <property name="use_underline">True</property>
20- <signal name="activate" handler="please_restart"/>
21+ <signal name="activate" handler="please_start"/>
22 <child internal-child="image">
23 <widget class="GtkImage" id="menu-item-image7">
24 <property name="stock">gtk-media-play</property>
25
26=== modified file 'RapacheCore/Apache.py'
27--- RapacheCore/Apache.py 2008-09-15 04:16:47 +0000
28+++ RapacheCore/Apache.py 2010-05-20 16:23:24 +0000
29@@ -40,16 +40,22 @@
30 return False
31
32 def start(self):
33- Shell.command.sudo_execute(["apache2ctl", "start"])
34+ Shell.command.gksudo(
35+ "gksudo service apache2 start",
36+ "Apache http server will be started with the command:")
37 return
38
39 def stop(self):
40- #Shell.command.sudo_execute(["apache2ctl", "-k", "graceful"])
41- Shell.command.sudo_execute(["apache2ctl", "stop"])
42+ Shell.command.gksudo(
43+ "gksudo service apache2 stop",
44+ "Apache http server will be stopped with the command:",
45+ "warning")
46 return
47
48 def restart(self):
49- Shell.command.sudo_execute(["apache2ctl", "graceful"])
50+ Shell.command.gksudo(
51+ "gksudo service apache2 restart",
52+ "Apache http server will be restarted with the command:")
53 return
54
55 def test_config(self):
56
57=== modified file 'RapacheCore/Shell.py'
58--- RapacheCore/Shell.py 2008-09-08 00:18:34 +0000
59+++ RapacheCore/Shell.py 2010-05-20 16:23:24 +0000
60@@ -43,6 +43,7 @@
61 import glob
62 import operator
63 import Configuration
64+import gtk
65
66 class CommandLogEntry:
67
68@@ -289,6 +290,26 @@
69 def ask_password(self, description = "Super user priviledges are required to perform this operation"):
70 res = self.sudo_execute( ['echo'], description = "Super user priviledges are required to perform this operation" )
71 return res[0] == 0
72+
73+ # gksudo is used to start/stop apache and mysql services
74+ def gksudo(self, cmd, comment, msg = "info"):
75+ if (msg=="info"):
76+
77+ dialog = gtk.MessageDialog(None,
78+ gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT,
79+ gtk.MESSAGE_INFO, gtk.BUTTONS_OK,
80+ comment+"\n\n"+cmd[2:])
81+
82+ else:
83+ dialog = gtk.MessageDialog(None,
84+ gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT,
85+ gtk.MESSAGE_WARNING, gtk.BUTTONS_OK,
86+ comment+"\n\n"+cmd[2:])
87+
88+ dialog.run()
89+ os.system(cmd)
90+ dialog.destroy()
91+
92 def sudo_execute(self, command, description = "Super user priviledges are required to perform this operation"):
93 #log = CommandLogEntry(command)
94 #self.command_log.append( log )
95
96=== modified file 'RapacheGtk/RapacheGui.py'
97--- RapacheGtk/RapacheGui.py 2008-09-15 06:53:55 +0000
98+++ RapacheGtk/RapacheGui.py 2010-05-20 16:23:24 +0000
99@@ -86,8 +86,9 @@
100 self.xml = gtk.glade.XML(self.gladefile)
101 #Create our dictionary and connect it
102 dic = { "new_button_clicked" : self.new_button_clicked,
103- "on_MainWindow_destroy" : self.quit ,
104- "please_restart" : self.restart_apache ,
105+ "on_MainWindow_destroy" : self.quit,
106+ "please_start" : self.start_apache,
107+ "please_restart" : self.restart_apache,
108 "on_delete" : self.delete_button_clicked,
109 "edit_button_clicked" : self.edit_button_clicked,
110 "edit_module_button_clicked" : self.edit_module_button_clicked,
111@@ -389,16 +390,22 @@
112 self.refresh_vhosts()
113 self.refresh_modules()
114 self.refresh_config_test(focus_error)
115-
116+
117+ def start_apache ( self, widget ):
118+ print "Starting apache on user's request"
119+ self.apache.start()
120+ self.update_server_status()
121+ self.xml.get_widget( 'restart_apache_notice' ).show()
122+
123 def please_restart ( self ):
124 self.xml.get_widget( 'restart_apache_notice' ).show()
125 def restart_apache ( self, widget ):
126- if not Shell.command.ask_password(): return
127+ #if not Shell.command.ask_password(): return # Not usefull: password is handle by gksudo
128 print "Restarting apache on user's request"
129 self.apache.restart()
130 self.update_server_status()
131 self.xml.get_widget( 'restart_apache_notice' ).hide()
132- self.refresh_lists(True)
133+ #self.refresh_lists(True) # FIXME
134
135 def is_vhost_editable (self, name):
136 return name != 'default'
137
138=== modified file 'setup.py'
139--- setup.py 2008-09-16 14:00:49 +0000
140+++ setup.py 2010-05-20 16:23:24 +0000
141@@ -21,22 +21,23 @@
142 from distutils.core import setup
143 setup(
144 name='rapache',
145+ version='0.7',
146 author='Rapache Developers',
147 author_email='rapache-devel@lists.launchpad.net',
148 maintainer='Emanuele Gentili',
149 maintainer_email='emgent@ubuntu.com',
150 description='Simple tool for managing and configuring an apache2 instance',
151- url = 'http://www.rapache.org',
152+ url = 'http://launchpad.net/rapache',
153 license='GNU GPL',
154 packages=['RapacheCore', 'RapacheGtk'],
155 scripts=['rapache', 'hosts-manager'],
156 data_files=[
157- ('share/rapache/Glade', glob.glob('Glade/*')),
158+ ('/usr/share/rapache/Glade', glob.glob('Glade/*')),
159 ('lib/rapache/plugins/', glob.glob('plugins/__init__.py')),
160 ('lib/rapache/plugins/ssl', glob.glob('plugins/ssl/*')),
161 ('lib/rapache/plugins/advanced', glob.glob('plugins/advanced/*')),
162 ('lib/rapache/plugins/basic_authentication', glob.glob('plugins/basic_authentication/*')),
163- ('share/applications', ['data/rapache.desktop']),
164+ ('/usr/share/applications', ['data/rapache.desktop']),
165 ],
166 )
167

Subscribers

People subscribed via source and target branches

to all changes: