Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.package
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Xiaowu Zhang
slapos.package
Commits
79e7303f
Commit
79e7303f
authored
Sep 05, 2012
by
Cédric Le Ninivin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added ntp to slapprepare for one-disk and and in boot script
parent
86bc29f4
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
19 deletions
+23
-19
slapprepare/slapprepare/__init__.py
slapprepare/slapprepare/__init__.py
+21
-2
slapprepare/slapprepare/script/slapos
slapprepare/slapprepare/script/slapos
+1
-0
slapprepare/slapprepare/script/slapos_firstboot
slapprepare/slapprepare/script/slapos_firstboot
+1
-17
No files found.
slapprepare/slapprepare/__init__.py
View file @
79e7303f
...
@@ -33,6 +33,8 @@ from subprocess import call as subprocessCall
...
@@ -33,6 +33,8 @@ from subprocess import call as subprocessCall
import
sys
import
sys
import
urllib2
import
urllib2
SLAPOS_MARK
=
'# Added by SlapOS
\
n
'
__import__
(
'pkg_resources'
).
declare_namespace
(
__name__
)
__import__
(
'pkg_resources'
).
declare_namespace
(
__name__
)
...
@@ -138,12 +140,12 @@ def get_ssh(temp_dir):
...
@@ -138,12 +140,12 @@ def get_ssh(temp_dir):
try
:
try
:
ssh_key_all
=
urllib2
.
urlopen
(
''
.
join
(
ssh_web
))
ssh_key_all
=
urllib2
.
urlopen
(
''
.
join
(
ssh_web
))
gotten
=
True
gotten
=
True
except
ValueError
,
err
:
except
ValueError
:
# add http:// if it is missing (needed by urllib2)
# add http:// if it is missing (needed by urllib2)
ssh_web
=
"""http://"""
+
ssh_web
ssh_web
=
"""http://"""
+
ssh_web
ssh_key_all
=
urllib2
.
urlopen
(
''
.
join
(
ssh_web
))
ssh_key_all
=
urllib2
.
urlopen
(
''
.
join
(
ssh_web
))
gotten
=
True
gotten
=
True
except
urllib2
.
URLError
,
err
:
except
urllib2
.
URLError
:
print
" URL ERROR"
print
" URL ERROR"
gotten
=
False
gotten
=
False
count
-=
1
count
-=
1
...
@@ -300,6 +302,21 @@ log /var/log/openvpn.log""" % dict(
...
@@ -300,6 +302,21 @@ log /var/log/openvpn.log""" % dict(
print
"SlapOS Image configuration: DONE"
print
"SlapOS Image configuration: DONE"
return
0
return
0
def
configureNtp
():
"""Configures NTP daemon"""
server
=
"server pool.ntp.org"
old_ntp
=
open
(
'/etc/ntp.conf'
,
'r'
).
readlines
()
new_ntp
=
open
(
'/etc/ntp.conf'
,
'w'
)
for
line
in
old_ntp
:
if
line
.
startswith
(
'server'
):
continue
new_ntp
.
write
(
line
)
new_ntp
.
write
(
SLAPOS_MARK
)
new_ntp
.
write
(
server
+
'
\
n
'
)
new_ntp
.
close
()
_call
([
'chkconfig'
,
'--add'
,
'ntp'
])
_call
([
'systemctl'
,
'enable'
,
'ntp.service'
])
class
Config
:
class
Config
:
def
setConfig
(
self
,
mount_dir_path
,
slapos_configuration
,
def
setConfig
(
self
,
mount_dir_path
,
slapos_configuration
,
...
@@ -401,6 +418,8 @@ def slapprepare():
...
@@ -401,6 +418,8 @@ def slapprepare():
computer_id
=
computer_id
)
computer_id
=
computer_id
)
configureNtp
()
# Prepare SlapOS Suse Server confuguration
# Prepare SlapOS Suse Server confuguration
if
config
.
need_ssh
:
if
config
.
need_ssh
:
...
...
slapprepare/slapprepare/script/slapos
View file @
79e7303f
...
@@ -28,6 +28,7 @@
...
@@ -28,6 +28,7 @@
systemctl stop slapos-node.service
systemctl stop slapos-node.service
systemctl disable slapos-node.service
systemctl disable slapos-node.service
systemctl restart ntp.service
# clean the system
# clean the system
for
service
in
rpcbind network-remotefs postfix
;
do
for
service
in
rpcbind network-remotefs postfix
;
do
...
...
slapprepare/slapprepare/script/slapos_firstboot
View file @
79e7303f
...
@@ -159,22 +159,6 @@ def prepareSlapOSPartition(mount_point):
...
@@ -159,22 +159,6 @@ def prepareSlapOSPartition(mount_point):
callWithCheck
([
'mount'
,
'/tmp'
])
callWithCheck
([
'mount'
,
'/tmp'
])
callWithCheck
([
'mount'
,
'/srv'
])
callWithCheck
([
'mount'
,
'/srv'
])
def
configureNtp
():
"""Configures NTP daemon"""
server
=
"server pool.ntp.org"
old_ntp
=
open
(
'/etc/ntp.conf'
,
'r'
).
readlines
()
new_ntp
=
open
(
'/etc/ntp.conf'
,
'w'
)
for
line
in
old_ntp
:
if
line
.
startswith
(
'server'
):
continue
new_ntp
.
write
(
line
)
new_ntp
.
write
(
SLAPOS_MARK
)
new_ntp
.
write
(
server
+
'
\
n
'
)
new_ntp
.
close
()
callWithIgnore
([
'chkconfig'
,
'--add'
,
'ntp'
])
callWithIgnore
([
'systemctl'
,
'enable'
,
'ntp.service'
])
callWithIgnore
([
'systemctl'
,
'restart'
,
'ntp.service'
])
def
getMountedPartitionList
():
def
getMountedPartitionList
():
partition_list
=
[]
partition_list
=
[]
for
line
in
open
(
'/etc/mtab'
,
'r'
).
readlines
():
for
line
in
open
(
'/etc/mtab'
,
'r'
).
readlines
():
...
@@ -299,7 +283,7 @@ def run():
...
@@ -299,7 +283,7 @@ def run():
prepareSlapOSPartition
(
mount_point
)
prepareSlapOSPartition
(
mount_point
)
print
"Configuring fallback grub information"
print
"Configuring fallback grub information"
configureGrub
(
mount_point
,
slapos_label_file
)
configureGrub
(
mount_point
,
slapos_label_file
)
configureNtp
()
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
try
:
try
:
...
...
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