Skip to content

Commit

Permalink
Merge pull request #2926 from phillxnet/2924-Inactive-NFS-export-vali…
Browse files Browse the repository at this point in the history
…dation

Inactive NFS export validation #2924
  • Loading branch information
phillxnet authored Nov 13, 2024
2 parents 8b0cb74 + c0611f2 commit a8e7d23
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/rockstor/storageadmin/models/nfs_export_group.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,10 @@ class NFSExportGroup(models.Model):
INSECURE = "insecure"

"""hostname string in /etc/exports"""
host_str = models.CharField(max_length=4096, validators=[validators.validate_nfs_host_str])
host_str = models.CharField(
max_length=4096, validators=[validators.validate_nfs_host_str]
)
"""mount options"""
"""mount read only by default"""
MODIFY_CHOICES = (
(READ_ONLY, "ro"),
(READ_WRITE, "rw"),
Expand Down Expand Up @@ -69,3 +70,4 @@ class NFSExportGroup(models.Model):

class Meta:
app_label = "storageadmin"
ordering = ["-id"]
2 changes: 2 additions & 0 deletions src/rockstor/storageadmin/views/nfs_exports.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@ def post(self, request):

cur_exports = list(NFSExport.objects.all())
eg = NFSExportGroup(**options)
eg.clean_fields(exclude="admin_host")
eg.save()
for s in shares:
mnt_pt = "%s%s" % (settings.MNT_PT, s.name)
Expand Down Expand Up @@ -237,6 +238,7 @@ def put(self, request, export_id):
s, options["host_str"], request, export_id=int(export_id)
)
NFSExportGroup.objects.filter(id=export_id).update(**options)
NFSExportGroup.objects.filter(id=export_id)[0].clean_fields(exclude="admin_host")
NFSExportGroup.objects.filter(id=export_id)[0].save()
cur_exports = list(NFSExport.objects.all())
for e in NFSExport.objects.filter(export_group=eg):
Expand Down

0 comments on commit a8e7d23

Please sign in to comment.