commit message from python script
This commit is contained in:
@@ -3,10 +3,11 @@
|
||||
import os, sys, subprocess
|
||||
|
||||
class nfs_server_conf:
|
||||
def __init__(self, nfs_srv_folders = ["/nfsroot/publicnfs","/nfsroot/datennfs"]) -> None:
|
||||
def __init__(self, nfs_srv_folders = ["/nfsroot/publicnfs","/nfsroot/datennfs"], nfs_config_file = "/etc/exports") -> None:
|
||||
if not os.geteuid()==0:
|
||||
raise PermissionError("Sie sind kein Root")
|
||||
self.nfs_srv_folders = nfs_srv_folders
|
||||
self.nfs_config_file = nfs_config_file
|
||||
|
||||
def mount_serverfolder(self):
|
||||
for srv_folder in self.nfs_srv_folders:
|
||||
@@ -37,10 +38,22 @@ class nfs_server_conf:
|
||||
|
||||
|
||||
def nfs_server_conf(self):
|
||||
with open("/etc/exports",'r') as exportfs_file:
|
||||
for exportfs_line in map(str(exportfs_file.readlines()).rstrip("\n")):
|
||||
print(exportfs_line)
|
||||
#print(exportfs_line.rstrip("\n"), sep="")
|
||||
folder_count = []
|
||||
for srv_folder in self.nfs_srv_folders:
|
||||
index_count = 0
|
||||
with open(self.nfs_config_file,'r') as exportfs_file:
|
||||
exportfs_exist = []
|
||||
print(srv_folder)
|
||||
for exportfs_line in exportfs_file.readlines():
|
||||
checkline = exportfs_line.rstrip("\n")[0:len(srv_folder)]
|
||||
if checkline == srv_folder:
|
||||
index_count += 1
|
||||
folder_count.append({"folder_name": srv_folder, "count_exist":index_count})
|
||||
|
||||
|
||||
for folder_counting in folder_count:
|
||||
if folder_counting["count_exist"] > 0:
|
||||
print(folder_counting["folder_name"], "ist vorhanden in", self.nfs_config_file )
|
||||
|
||||
|
||||
def nfs_con_user(self):
|
||||
|
||||
Reference in New Issue
Block a user