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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Nicolas Wavrant
slapos.package
Commits
0a84752c
Commit
0a84752c
authored
Feb 25, 2013
by
Jean-Baptiste Petre
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add def function
parent
894b5ebc
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
57 additions
and
56 deletions
+57
-56
slapprepare/slapprepare/slapos-cfg-update.py
slapprepare/slapprepare/slapos-cfg-update.py
+57
-56
No files found.
slapprepare/slapprepare/slapos-cfg-update.py
View file @
0a84752c
...
...
@@ -29,86 +29,87 @@
import
ConfigParser
,
os
from
os
import
chdir
config
=
ConfigParser
.
RawConfigParser
()
# search slapos.cfg
slapos_path_configuration_old
=
"/etc/slapos/slapos.cfg"
slapos_path_configuration
=
"/etc/opt/slapos/slapos.cfg"
def
slapos_cfg_update
():
config
=
ConfigParser
.
RawConfigParser
()
# check path slapos.cfg
if
os
.
path
.
isfile
(
slapos_path_configuration_old
)
==
True
:
# search slapos.cfg
slapos_path_configuration_old
=
"/etc/slapos/slapos.cfg"
slapos_path_configuration
=
"/etc/opt/slapos/slapos.cfg"
# check path slapos.cfg
if
os
.
path
.
isfile
(
slapos_path_configuration_old
)
==
True
:
path_slapos
=
"/etc/slapos/"
if
os
.
path
.
isfile
(
slapos_path_configuration
)
==
True
:
if
os
.
path
.
isfile
(
slapos_path_configuration
)
==
True
:
path_slapos
=
"/etc/opt/slapos/"
# deplacement the real folder
chdir
(
path_slapos
)
# deplacement the real folder
chdir
(
path_slapos
)
# read slapos.cfg
config
.
read
(
'slapos.cfg'
)
# read slapos.cfg
config
.
read
(
'slapos.cfg'
)
# SECTION slapformat
# SECTION slapformat
# convert bridge_name -> interface_name
# convert bridge_name -> interface_name
if
config
.
has_option
(
'slapformat'
,
'bridge_name'
)
==
True
:
if
config
.
has_option
(
'slapformat'
,
'bridge_name'
)
==
True
:
bridge_name_interface
=
config
.
get
(
'slapformat'
,
'bridge_name'
)
config
.
remove_option
(
'slapformat'
,
'bridge_name'
)
config
.
set
(
'slapformat'
,
'interface_name'
,
bridge_name_interface
)
# add log_file = /opt/slapos/slapformat.log
if
config
.
has_option
(
'slapformat'
,
'log_file'
)
==
False
:
# add log_file = /opt/slapos/slapformat.log
if
config
.
has_option
(
'slapformat'
,
'log_file'
)
==
False
:
config
.
set
(
'slapformat'
,
'log_file'
,
'/opt/slapos/slapformat.log'
)
ipv6_interface
=
config
.
has_option
(
'slapformat'
,
'ipv6_interface'
)
if
ipv6_interface
==
False
:
ipv6_interface
=
config
.
has_option
(
'slapformat'
,
'ipv6_interface'
)
if
ipv6_interface
==
False
:
config
.
set
(
'slapformat'
,
'ipv6_interface'
,
'tapVPN'
)
# SECTION networkcache
# SECTION networkcache
# checking the section true or false
check_section_networkcache
=
config
.
has_section
(
'networkcache'
)
# checking the section true or false
check_section_networkcache
=
config
.
has_section
(
'networkcache'
)
# add from section networkcache if there is not
if
check_section_networkcache
==
False
:
# add from section networkcache if there is not
if
check_section_networkcache
==
False
:
config
.
add_section
(
'networkcache'
)
# check the part network
# check the part network
check_section_networkcache_download_binary_cache_url
=
config
.
has_option
(
'networkcache'
,
'download-binary-cache-url'
)
check_section_networkcache_download_cache_url
=
config
.
has_option
(
'networkcache'
,
'download-cache-url'
)
check_section_networkcache_download_binary_dir_url
=
config
.
has_option
(
'networkcache'
,
'download-binary-dir-url'
)
check_section_networkcache_signature_certificate_list
=
config
.
has_option
(
'networkcache'
,
'signature-certificate-list'
)
check_section_networkcache_download_from_binary_cache_url_blacklist
=
config
.
has_option
(
'networkcache'
,
'download-from-binary-cache-url-blacklist'
)
check_section_networkcache_upload_to_binary_cache_url_blacklist
=
config
.
has_option
(
'networkcache'
,
'upload-to-binary-cache-url-blacklist'
)
check_section_networkcache_download_binary_cache_url
=
config
.
has_option
(
'networkcache'
,
'download-binary-cache-url'
)
check_section_networkcache_download_cache_url
=
config
.
has_option
(
'networkcache'
,
'download-cache-url'
)
check_section_networkcache_download_binary_dir_url
=
config
.
has_option
(
'networkcache'
,
'download-binary-dir-url'
)
check_section_networkcache_signature_certificate_list
=
config
.
has_option
(
'networkcache'
,
'signature-certificate-list'
)
check_section_networkcache_download_from_binary_cache_url_blacklist
=
config
.
has_option
(
'networkcache'
,
'download-from-binary-cache-url-blacklist'
)
check_section_networkcache_upload_to_binary_cache_url_blacklist
=
config
.
has_option
(
'networkcache'
,
'upload-to-binary-cache-url-blacklist'
)
# check 1 - 1 a section networkcache
# check 1 - 1 a section networkcache
if
check_section_networkcache_download_binary_cache_url
==
False
:
if
check_section_networkcache_download_binary_cache_url
==
False
:
config
.
set
(
'networkcache'
,
'download-binary-cache-url'
,
'http://www.shacache.org/shacache'
)
if
check_section_networkcache_download_cache_url
==
False
:
if
check_section_networkcache_download_cache_url
==
False
:
config
.
set
(
'networkcache'
,
'download-cache-url'
,
'https://www.shacache.org/shacache'
)
if
check_section_networkcache_download_binary_dir_url
==
False
:
if
check_section_networkcache_download_binary_dir_url
==
False
:
config
.
set
(
'networkcache'
,
'download-binary-dir-url'
,
'http://www.shacache.org/shadir'
)
if
check_section_networkcache_signature_certificate_list
==
False
:
if
check_section_networkcache_signature_certificate_list
==
False
:
config
.
set
(
'networkcache'
,
'signature-certificate-list'
,
'
\
n
-----BEGIN CERTIFICATE-----
\
n
MIIB4DCCAUkCADANBgkqhkiG9w0BAQsFADA5MQswCQYDVQQGEwJGUjEZMBcGA1UE
\
n
CBMQRGVmYXVsdCBQcm92aW5jZTEPMA0GA1UEChMGTmV4ZWRpMB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MxETAPBgNV
\
n
BAMMCENPTVAtNzcyMCAXDTEyMDgxMDE1NDI1MVoYDzIxMTIwNzE3MTU0MjUxWjAT
\
n
MREwDwYDVQQDDAhDT01QLTc3MjCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEA
\
n
o7aipd6MbnuGDeR1UJUjuMLQUariAyQ2l2ZDS6TfOwjHiPw/mhzkielgk73kqN7A
\
n
sUREx41eTcYCXzTq3WP3xCLE4LxLg1eIhd4nwNHj8H18xR9aP0AGjo4UFl5BOMa1
\
n
mwoyBt3VtfGtUmb8whpeJgHhqrPPxLoON+i6fIbXDaUCAwEAAaNQME4wHQYDVR0O
\
n
BBYEFEfjy3OopT2lOksKmKBNHTJE2hFlMB8GA1UdIwQYMBaAFEfjy3OopT2lOksK
\
n
mKBNHTJE2hFlMAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEFBQADgYEAaNRx6YN2
\
n
M/p3R8/xS6zvH1EqJ3FFD7XeAQ52WuQnKSREzuw0dsw12ClxjcHiQEFioyTiTtjs
\
n
5pW18Ry5Ie7iFK4cQMerZwWPxBodEbAteYlRsI6kePV7Gf735Y1RpuN8qZ2sYL6e
\
n
x2IMeSwJ82BpdEI5niXxB+iT0HxhmR+XaMI=
\
n
-----END CERTIFICATE-----'
)
if
check_section_networkcache_download_from_binary_cache_url_blacklist
==
False
:
if
check_section_networkcache_download_from_binary_cache_url_blacklist
==
False
:
config
.
set
(
'networkcache'
,
'download-from-binary-cache-url-blacklist'
,
'
\
n
http://git.erp5.org/gitweb/slapos.git/blob_plain/HEAD
\
n
http://git.erp5.org/gitweb/slapos.core.git/blob_plain/refs/heads
\
n
/'
)
if
check_section_networkcache_upload_to_binary_cache_url_blacklist
==
False
:
if
check_section_networkcache_upload_to_binary_cache_url_blacklist
==
False
:
config
.
set
(
'networkcache'
,
'upload-to-binary-cache-url-blacklist'
,
'
\
n
http://git.erp5.org/gitweb/slapos.git/blob_plain/HEAD
\
n
http://git.erp5.org/gitweb/slapos.core.git/blob_plain/refs/heads
\
n
/'
)
# writing slapos.cfg
with
open
(
'slapos.cfg'
,
'wb'
)
as
configfile
:
# writing slapos.cfg
with
open
(
'slapos.cfg'
,
'wb'
)
as
configfile
:
config
.
write
(
configfile
)
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