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
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
Eric Zheng
slapos
Commits
89b3dec7
Commit
89b3dec7
authored
Aug 14, 2020
by
Bryton Lacquement
🚪
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
recipe/generic_mysql: add support for Python 3 (NEEDS TO BE RELEASED BEFORE)
parent
fbd225c3
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
8 deletions
+9
-8
slapos/recipe/generic_mysql/mysql.py
slapos/recipe/generic_mysql/mysql.py
+9
-8
No files found.
slapos/recipe/generic_mysql/mysql.py
View file @
89b3dec7
from
__future__
import
print_function
import
os
import
subprocess
import
time
...
...
@@ -6,7 +7,7 @@ import pytz
def
updateMysql
(
mysql_upgrade_binary
,
mysql_binary
,
mysql_script_file
):
sleep
=
0
with
open
(
mysql_script_file
)
as
script_file
:
with
open
(
mysql_script_file
,
'rb'
)
as
script_file
:
mysql_script
=
script_file
.
read
()
mysql_list
=
mysql_binary
,
'-B'
mysql_tzinfo_to_sql_list
=
(
...
...
@@ -19,32 +20,32 @@ def updateMysql(mysql_upgrade_binary, mysql_binary, mysql_script_file):
stdout
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
STDOUT
)
result
=
mysql_upgrade
.
communicate
()[
0
]
if
mysql_upgrade
.
returncode
:
print
"Command %r failed with result:
\
n
%s"
%
(
mysql_upgrade_binary
,
result
)
print
(
"Command %r failed with result:
\
n
%s"
%
(
mysql_upgrade_binary
,
result
)
)
break
print
"MySQL database upgraded with result:
\
n
%s"
%
result
print
(
"MySQL database upgraded with result:
\
n
%s"
%
result
)
mysql
=
subprocess
.
Popen
(
mysql_list
,
stdin
=
subprocess
.
PIPE
,
stdout
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
STDOUT
)
result
=
mysql
.
communicate
(
mysql_script
)[
0
]
if
mysql
.
returncode
:
print
'Command %r failed with:
\
n
%s'
%
(
mysql_list
,
result
)
print
(
'Command %r failed with:
\
n
%s'
%
(
mysql_list
,
result
)
)
break
# import timezone database
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_tzinfo_to_sql
.
returncode
!=
0
:
print
'Command %r failed with:
\
n
%s'
%
(
mysql_tzinfo_to_sql_list
,
result
)
print
(
'Command %r failed with:
\
n
%s'
%
(
mysql_tzinfo_to_sql_list
,
result
)
)
break
mysql
=
subprocess
.
Popen
(
mysql_list
+
(
'mysql'
,),
stdin
=
subprocess
.
PIPE
,
stdout
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
STDOUT
)
result
=
mysql
.
communicate
(
timezone_sql
)[
0
]
if
mysql
.
returncode
:
print
'Command %r failed with:
\
n
%s'
%
(
mysql_list
,
result
)
print
(
'Command %r failed with:
\
n
%s'
%
(
mysql_list
,
result
)
)
break
print
'SlapOS initialisation script succesfully applied on database.'
print
(
'SlapOS initialisation script succesfully applied on database.'
)
return
sleep
=
min
(
sleep
+
1
,
30
)
print
'Sleeping for %ss and retrying'
%
sleep
print
(
'Sleeping for %ss and retrying'
%
sleep
)
sys
.
stdout
.
flush
()
sys
.
stderr
.
flush
()
time
.
sleep
(
sleep
)
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