Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
settingsd
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
etersoft
settingsd
Commits
5a766a84
Commit
5a766a84
authored
Dec 17, 2010
by
Devaev Maxim
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added loading default configs for dnsmasq
parent
c9dea185
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
4 deletions
+18
-4
fmod_dnsmasq_config.py
plugins/functions/fmod_dnsmasq_config.py
+18
-4
No files found.
plugins/functions/fmod_dnsmasq_config.py
View file @
5a766a84
...
...
@@ -4,7 +4,9 @@
import
os
import
re
import
signal
import
shutil
from
settingsd
import
const
from
settingsd
import
config
from
settingsd
import
service
from
settingsd
import
shared
...
...
@@ -134,10 +136,20 @@ class SimpleDnsmasqConfig(service.FunctionObject) :
if
not
type
(
values_list
)
.
__name__
in
(
"list"
,
"tuple"
)
:
values_list
=
[
values_list
]
if
not
os
.
access
(
config
.
value
(
SERVICE_NAME
,
"dnsmasq_config_file_path"
),
os
.
F_OK
)
:
open
(
config
.
value
(
SERVICE_NAME
,
"dnsmasq_config_file_path"
),
"w"
)
.
close
()
dnsmasq_config_file_path
=
config
.
value
(
SERVICE_NAME
,
"dnsmasq_config_file_path"
)
dnsmasq_config_file
=
open
(
config
.
value
(
SERVICE_NAME
,
"dnsmasq_config_file_path"
),
"r+"
)
###
dnsmasq_config_file_path_sample
=
config_value
(
SERVICE_NAME
,
"dnsmasq_config_file_path_sample"
)
if
not
os
.
access
(
dnsmasq_config_file_path
,
os
.
F_OK
)
:
if
access
(
dnsmasq_config_file_path_sample
,
os
.
F_OK
)
:
shutil
.
copy2
(
dnsmasq_config_file_path_sample
,
dnsmasq_config_file_path
)
else
:
open
(
dnsmasq_config_file_path
,
"w"
)
.
close
()
###
dnsmasq_config_file
=
open
(
dnsmasq_config_file_path
,
"r+"
)
dnsmasq_config_file_data
=
dnsmasq_config_file
.
read
()
variable_regexp
=
re
.
compile
(
r"(((\n|\A)
%
s[\s\t]*=[^\n]*)+)"
%
(
variable_name
))
...
...
@@ -196,6 +208,8 @@ class Service(service.Service) :
@classmethod
def
options
(
self
)
:
return
[
(
SERVICE_NAME
,
"dnsmasq_config_file_path"
,
"/etc/dnsmasq.conf"
,
str
)
(
SERVICE_NAME
,
"dnsmasq_config_file_path"
,
"/etc/dnsmasq.conf"
,
str
),
(
SERVICE_NAME
,
"dnsmasq_config_file_path_sample"
,
os
.
path
.
join
(
const
.
FUNCTIONS_DATA_DIR
,
SERVICE_NAME
,
"dnsmasq.conf"
),
str
)
]
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment