Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #991 #1011

Merged
merged 2 commits into from
Nov 11, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 10 additions & 9 deletions src/rockstor/storageadmin/views/command.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,15 @@
SessionAuthentication)
from storageadmin.auth import DigestAuthentication
from rest_framework.permissions import IsAuthenticated
from system.osi import (uptime, refresh_nfs_exports, kernel_info)
from system.osi import (uptime, kernel_info)
from fs.btrfs import (mount_share, device_scan, mount_root, qgroup_create,
get_pool_info, pool_raid, pool_usage, shares_info,
share_usage, snaps_info, mount_snap)
from system.ssh import (sftp_mount_map, sftp_mount)
from system.services import systemctl
from system.osi import (is_share_mounted, system_shutdown, system_reboot)
from storageadmin.models import (Share, Disk, NFSExport, SFTP, Pool, Snapshot,
UpdateSubscription)
UpdateSubscription, AdvancedNFSExport)
from storageadmin.util import handle_exception
from datetime import datetime
from django.utils.timezone import utc
Expand Down Expand Up @@ -87,7 +87,6 @@ def post(self, request, command):
e_msg = ('Failed to make the Snapshot(%s) visible. '
'Exception: %s' % (snap.real_name, e.__str__()))
logger.error(e_msg)
logger.exception(e)

mnt_map = sftp_mount_map(settings.SFTP_MNT_ROOT)
for sftpo in SFTP.objects.all():
Expand All @@ -101,10 +100,13 @@ def post(self, request, command):
logger.error(e_msg)

try:
adv_entries = [a.export_str for a in AdvancedNFSExport.objects.all()]
exports_d = self.create_adv_nfs_export_input(adv_entries, request)
exports = self.create_nfs_export_input(NFSExport.objects.all())
refresh_nfs_exports(exports)
exports.update(exports_d)
self.refresh_wrapper(exports, request, logger)
except Exception, e:
e_msg = ('Exception while exporting NFS: %s' % e.__str__())
e_msg = ('Exception while bootstrapping NFS: %s' % e.__str__())
logger.error(e_msg)

# bootstrap services
Expand Down Expand Up @@ -174,8 +176,7 @@ def post(self, request, command):
system_shutdown()
except Exception, e:
msg = ('Failed to shutdown the system due to a low level '
'error')
logger.exception(e)
'error: %s' % e.__str__())
handle_exception(Exception(msg), request)
finally:
return Response(msg)
Expand All @@ -186,8 +187,8 @@ def post(self, request, command):
request.session.flush()
system_reboot()
except Exception, e:
msg = ('Failed to reboot the system due to a low level error')
logger.exception(e)
msg = ('Failed to reboot the system due to a low level error: '
'%s' % e.__str__())
handle_exception(Exception(msg), request)
finally:
return Response(msg)
Expand Down