Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
slapos
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
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Iliya Manolov
slapos
Commits
b7c111de
Commit
b7c111de
authored
Sep 12, 2012
by
Kazuhiko Shiozaki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
set up timezone database in mariab's mysql table so that we can use timezone conversion function.
parent
a4f70eb6
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
2 deletions
+24
-2
setup.py
setup.py
+1
-0
slapos/recipe/generic_mysql/mysql.py
slapos/recipe/generic_mysql/mysql.py
+23
-2
No files found.
setup.py
View file @
b7c111de
...
...
@@ -36,6 +36,7 @@ setup(name=name,
'xml_marshaller'
,
# need to communication with slapgrid
'zc.buildout'
,
# plays with buildout
'zc.recipe.egg'
,
# for scripts generation
'pytz'
,
# for timezone database
],
zip_safe
=
True
,
entry_points
=
{
...
...
slapos/recipe/generic_mysql/mysql.py
View file @
b7c111de
...
...
@@ -2,6 +2,7 @@ import os
import
subprocess
import
time
import
sys
import
pytz
def
runMysql
(
args
):
...
...
@@ -65,6 +66,26 @@ def updateMysql(args):
print
'Command %r failed with:
\
n
%s'
%
(
mysql_list
,
result
)
print
'Sleeping for %ss and retrying'
%
sleep
else
:
# import timezone database
mysql_tzinfo_to_sql_binary
=
os
.
path
.
join
(
os
.
path
.
dirname
(
conf
[
'mysql_binary'
].
strip
()),
'mysql_tzinfo_to_sql'
)
zoneinfo_directory
=
'%s/zoneinfo'
%
os
.
path
.
dirname
(
pytz
.
__file__
)
mysql_tzinfo_to_sql_list
=
[
mysql_tzinfo_to_sql_binary
,
zoneinfo_directory
]
mysql_tzinfo_to_sql
=
subprocess
.
Popen
(
mysql_tzinfo_to_sql_list
,
stdin
=
subprocess
.
PIPE
,
stdout
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
PIPE
)
timezone_sql
=
mysql_tzinfo_to_sql
.
communicate
()[
0
]
if
mysql
.
returncode
!=
0
:
print
'Command %r failed with:
\
n
%s'
%
(
mysql_tzinfo_to_sql_list
,
result
)
print
'Sleeping for %ss and retrying'
%
sleep
else
:
mysql
=
subprocess
.
Popen
(
mysql_list
+
[
'mysql'
,],
stdin
=
subprocess
.
PIPE
,
stdout
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
STDOUT
)
result
=
mysql
.
communicate
(
timezone_sql
)[
0
]
if
mysql
.
returncode
is
None
:
mysql
.
kill
()
if
mysql
.
returncode
!=
0
:
print
'Command %r failed with:
\
n
%s'
%
(
mysql_list
,
result
)
print
'Sleeping for %ss and retrying'
%
sleep
is_succeed
=
True
print
'SlapOS initialisation script succesfully applied on database.'
sys
.
stdout
.
flush
()
...
...
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