mirror of
https://github.com/vale981/dirkules
synced 2025-03-04 17:01:40 -05:00
some comments and logging stuff
This commit is contained in:
parent
bccec3111e
commit
0d66084586
1 changed files with 16 additions and 1 deletions
|
@ -6,6 +6,15 @@ from dirkules.samba.models import SambaGlobal
|
|||
|
||||
|
||||
def set_samba_global(workgroup, name):
|
||||
"""
|
||||
Sets the variables for the [global] part in smb.conf
|
||||
:param workgroup: Workgroup name
|
||||
:type workgroup: string
|
||||
:param name: Smbd server name
|
||||
:type name: string
|
||||
:return: nothing
|
||||
:rtype: None
|
||||
"""
|
||||
SambaGlobal.query.delete()
|
||||
workgroup = SambaGlobal("workgroup", workgroup)
|
||||
name = SambaGlobal("server string", "%h {}".format(name))
|
||||
|
@ -15,10 +24,15 @@ def set_samba_global(workgroup, name):
|
|||
|
||||
|
||||
def generate_smb():
|
||||
"""
|
||||
Function is used to generate a new smb.conf file
|
||||
:return: nothing
|
||||
:rtype: None
|
||||
"""
|
||||
if SambaGlobal.query.first() is None:
|
||||
app.logger.warning("Samba not configured. Using default fallback.")
|
||||
workgroup = 'WORKGROUP'
|
||||
server_string = '%h dirkules'
|
||||
app.logger.warning("Samba not configured. Using default fallback.")
|
||||
else:
|
||||
workgroup = SambaGlobal.query.get(1)
|
||||
server_string = SambaGlobal.query.get(2)
|
||||
|
@ -31,3 +45,4 @@ def generate_smb():
|
|||
f.write("workgroup = {}\n".format(workgroup))
|
||||
f.write(samba_global.read())
|
||||
f.close()
|
||||
app.logger.info("Generated new samba config.")
|
||||
|
|
Loading…
Add table
Reference in a new issue