Commit 71224c30 authored by Marco Mariani's avatar Marco Mariani

symlink to software_release in each partition

parent 5b3837e7
...@@ -7,6 +7,7 @@ Changes ...@@ -7,6 +7,7 @@ Changes
* slapproxy: Filter by instance_guid, allow computer partition renames * slapproxy: Filter by instance_guid, allow computer partition renames
and change of software_type and requested_state [Marco Mariani] and change of software_type and requested_state [Marco Mariani]
* slapproxy: Stop instance even if buildout/reporting is wrong [Cedric de Saint Martin] * slapproxy: Stop instance even if buildout/reporting is wrong [Cedric de Saint Martin]
* symlink to software_release in each partition [Marco Mariani]
0.33.1 (2012-11-05) 0.33.1 (2012-11-05)
------------------- -------------------
......
...@@ -205,7 +205,7 @@ class Software(object): ...@@ -205,7 +205,7 @@ class Software(object):
if func == os.path.islink: if func == os.path.islink:
os.unlink(path) os.unlink(path)
else: else:
os.chmod (path, 0600) os.chmod(path, 0600)
func(path) func(path)
try: try:
if os.path.exists(self.software_path): if os.path.exists(self.software_path):
...@@ -304,6 +304,15 @@ class Partition(object): ...@@ -304,6 +304,15 @@ class Partition(object):
USER=pwd.getpwuid(uid).pw_name, USER=pwd.getpwuid(uid).pw_name,
) )
def updateSymlink(self, sr_symlink, software_path):
if os.path.exists(sr_symlink):
if not os.path.islink(sr_symlink):
self.logger.debug('Not a symlink: %s, has been ignored' % (sr_symlink))
return
os.unlink(sr_symlink)
os.symlink(software_path, sr_symlink)
os.lchown(sr_symlink, *self.getUserGroupId())
def install(self): def install(self):
""" Creates configuration file from template in software_path, then """ Creates configuration file from template in software_path, then
installs the software partition with the help of buildout installs the software partition with the help of buildout
...@@ -315,6 +324,10 @@ class Partition(object): ...@@ -315,6 +324,10 @@ class Partition(object):
if not os.path.isdir(self.instance_path): if not os.path.isdir(self.instance_path):
raise PathDoesNotExistError('Please create partition directory %s' raise PathDoesNotExistError('Please create partition directory %s'
% self.instance_path) % self.instance_path)
sr_symlink = os.path.join(self.instance_path, 'software_release')
self.updateSymlink(sr_symlink, self.software_path)
instance_stat_info = os.stat(self.instance_path) instance_stat_info = os.stat(self.instance_path)
permission = oct(stat.S_IMODE(instance_stat_info.st_mode)) permission = oct(stat.S_IMODE(instance_stat_info.st_mode))
if permission != REQUIRED_COMPUTER_PARTITION_PERMISSION: if permission != REQUIRED_COMPUTER_PARTITION_PERMISSION:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment