Skip to content

Commit

Permalink
2011-04-27 Erwann Chenede - <erwann.chenede@oracle.com>
Browse files Browse the repository at this point in the history
  * VERSION: Bump to 0.2.98
  * usr/share/time-slider/lib/time_slider/applet.py
    usr/share/time-slider/lib/time_slider/deletegui.py
    usr/share/time-slider/lib/time_slider/setupgui.py
    usr/share/time-slider/lib/time_slider/snapnowui.py
    usr/share/time-slider/lib/time_slider/timesliderd.py :
    Fix for 7038498 removed Primary Administrator references

  * usr/share/time-slider/lib/time_slider/util.py
    usr/share/time-slider/lib/time_slider/zfs.py :
    Fix for 6996354 gracefully handle snapshot failure
  • Loading branch information
Erwann Chenede committed Apr 27, 2011
1 parent 095b5d0 commit 4ba07f0
Show file tree
Hide file tree
Showing 9 changed files with 39 additions and 43 deletions.
14 changes: 14 additions & 0 deletions ChangeLog
@@ -1,3 +1,17 @@
2011-04-27 Erwann Chenede - <erwann.chenede@oracle.com>

* VERSION: Bump to 0.2.98
* usr/share/time-slider/lib/time_slider/applet.py
usr/share/time-slider/lib/time_slider/deletegui.py
usr/share/time-slider/lib/time_slider/setupgui.py
usr/share/time-slider/lib/time_slider/snapnowui.py
usr/share/time-slider/lib/time_slider/timesliderd.py :
Fix for 7038498 removed Primary Administrator references

* usr/share/time-slider/lib/time_slider/util.py
usr/share/time-slider/lib/time_slider/zfs.py :
Fix for 6996354 gracefully handle snapshot failure

2010-07-29 Niall Power - <niall.power@oracle.com>

* VERSION: Bump to 0.2.97
Expand Down
2 changes: 1 addition & 1 deletion VERSION
@@ -1 +1 @@
VERSION = 0.2.97
VERSION = 0.2.98
34 changes: 17 additions & 17 deletions usr/share/time-slider/lib/time_slider/applet.py
Expand Up @@ -130,16 +130,11 @@ def __init__(self, icon, menu):
# Use this variable to keep track of it's running status.
self._scriptRunning = False
self._targetDirAvail = False
# If the user is authorised, allow them to manually synchronise
# rsync backups.
self._syncNowItem = None
if os.geteuid() == 0 or \
rbac.RBACprofile().has_profile("Primary Administrator"):
self._syncNowItem = gtk.MenuItem(_("Update Backups Now"))
self._syncNowItem.set_sensitive(False)
self._syncNowItem.connect("activate",
self._sync_now)
self._menu.append(self._syncNowItem)
self._syncNowItem = gtk.MenuItem(_("Update Backups Now"))
self._syncNowItem.set_sensitive(False)
self._syncNowItem.connect("activate",
self._sync_now)
self._menu.append(self._syncNowItem)

self.refresh()

Expand Down Expand Up @@ -427,17 +422,22 @@ def refresh(self):
self._syncNowItem.hide()

def _sync_now(self, menuItem):
"""Runs the rsync-bacjup script manually
Assumes that user is either root or has the
Primary Administrator profile since it is only
called from the menu item which is invisilbe to
"""Runs the rsync-backup script manually
Assumes that user is root since it is only
called from the menu item which is invisible to
not authorised users
"""
cmdPath = os.path.join(os.path.dirname(sys.argv[0]), \
"time-slider/plugins/rsync/rsync-backup")
cmd = ["/usr/bin/pfexec", cmdPath, \
"%s:rsync" % (plugin.PLUGINBASEFMRI)]
subprocess.Popen(cmd, close_fds=True, cwd="/")
if os.geteuid() == 0:
cmd = [cmdPath, \
"%s:rsync" % (plugin.PLUGINBASEFMRI)]
else:
cmd = ['/usr/bin/gksu' ,cmdPath, \
"%s:rsync" % (plugin.PLUGINBASEFMRI)]

subprocess.Popen(cmd, close_fds=True, cwd="/")


class CleanupNote(Note):

Expand Down
10 changes: 0 additions & 10 deletions usr/share/time-slider/lib/time_slider/deletegui.py
Expand Up @@ -732,16 +732,6 @@ def main(argv):
glib.idle_add(manager.initialise_view)
gtk.main()
gtk.gdk.threads_leave()
elif rbacp.has_profile("Primary Administrator") or \
rbacp.has_profile("ZFS File System Management"):
# Run via pfexec, which will launch the GUI as superuser
arguments = []
arguments.append ("pfexec")
arguments.append (argv)
arguments += args
os.execv("/usr/bin/pfexec", arguments)
# Shouldn't reach this point
sys.exit(1)
elif os.path.exists(argv) and os.path.exists("/usr/bin/gksu"):
# Run via gksu, which will prompt for the root password
newargs = ["gksu", argv]
Expand Down
9 changes: 1 addition & 8 deletions usr/share/time-slider/lib/time_slider/setupgui.py
Expand Up @@ -1291,21 +1291,14 @@ def main(argv):
# This GUI can be launched with an euid of root in one of
# the following 3 ways;
# 0. Run by the superuser (root)
# 1. Run by a user assigned "Primary Administrator" profile.
# 3. Run via gksu to allow a non priviliged user to authenticate
# 1. Run via gksu to allow a non priviliged user to authenticate
# as the superuser (root)

if os.geteuid() == 0:
manager = SetupManager(argv)
gtk.gdk.threads_enter()
gtk.main()
gtk.gdk.threads_leave()
elif rbacp.has_profile("Primary Administrator"):
# Run via pfexec, which will launch the GUI as superuser
os.unsetenv("DBUS_SESSION_BUS_ADDRESS")
os.execl("/usr/bin/pfexec", "pfexec", argv)
# Shouldn't reach this point
sys.exit(1)
elif os.path.exists(argv) and os.path.exists("/usr/bin/gksu"):
# Run via gksu, which will prompt for the root password
os.unsetenv("DBUS_SESSION_BUS_ADDRESS")
Expand Down
3 changes: 1 addition & 2 deletions usr/share/time-slider/lib/time_slider/snapnowui.py
Expand Up @@ -195,8 +195,7 @@ def main(argv):
# - 1 or 4
# Note that an effective UID=0 will match any profile search so
# no need to check it explicitly.
if rbacp.has_profile("Primary Administrator") or \
rbacp.has_profile("ZFS File System Management"):
if rbacp.has_profile("ZFS File System Management"):
manager = SnapshotNowDialog(args[0],args[1])
gtk.main()
elif os.path.exists(argv) and os.path.exists("/usr/bin/gksu"):
Expand Down
1 change: 0 additions & 1 deletion usr/share/time-slider/lib/time_slider/timesliderd.py
Expand Up @@ -939,7 +939,6 @@ def main(argv):
create_daemon()

# The user security attributes checked are the following:
# 1. The "Primary Administrator" profile
# Note that UID == 0 will match any profile search so
# no need to check it explicitly.
syslog.openlog("time-sliderd", 0, syslog.LOG_DAEMON)
Expand Down
4 changes: 2 additions & 2 deletions usr/share/time-slider/lib/time_slider/util.py
Expand Up @@ -28,7 +28,7 @@
import math
import gio

def run_command(command):
def run_command(command, raise_on_try=True):
"""
Wrapper function around subprocess.Popen
Returns a tuple of standard out and stander error.
Expand All @@ -45,7 +45,7 @@ def run_command(command):
except OSError, message:
raise RuntimeError, "%s subprocess error:\n %s" % \
(command, str(message))
if err != 0:
if err != 0 and raise_on_try:
raise RuntimeError, '%s failed with exit code %d\n%s' % \
(str(command), err, errdata)
return outdata,errdata
Expand Down
5 changes: 3 additions & 2 deletions usr/share/time-slider/lib/time_slider/zfs.py
Expand Up @@ -856,7 +856,9 @@ def create_snapshot(self, snaplabel, recursive = False):
if recursive == True:
cmd.append("-r")
cmd.append("%s@%s" % (self.name, snaplabel))
outdata,errdata = util.run_command(cmd)
outdata,errdata = util.run_command(cmd, False)
if errdata:
print errdata
self.datasets.refresh_snapshots()

def list_children(self):
Expand Down Expand Up @@ -1045,4 +1047,3 @@ def list_zpools():
snap = Snapshot(snapshot, snaptime)
print "\t\t" + snap.name


0 comments on commit 4ba07f0

Please sign in to comment.