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
Labels
Merge Requests
103
Merge Requests
103
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
nexedi
slapos
Commits
2ae779a3
Commit
2ae779a3
authored
Dec 10, 2021
by
Alain Takoudjou
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Recipe generic_mysql now support python3
parent
37185926
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
11 deletions
+17
-11
slapos/recipe/generic_mysql/mysql.py
slapos/recipe/generic_mysql/mysql.py
+17
-11
No files found.
slapos/recipe/generic_mysql/mysql.py
View file @
2ae779a3
from
__future__
import
print_function
import
os
import
subprocess
import
time
...
...
@@ -16,35 +18,39 @@ def updateMysql(mysql_upgrade_binary, mysql_binary, mysql_script_file):
while
True
:
while
True
:
mysql_upgrade
=
subprocess
.
Popen
(
mysql_upgrade_binary
,
stdout
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
STDOUT
)
stdout
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
STDOUT
,
universal_newlines
=
True
)
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
)
stdout
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
STDOUT
,
universal_newlines
=
True
)
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
)
stdout
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
PIPE
,
universal_newlines
=
True
)
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
)
stdout
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
STDOUT
,
universal_newlines
=
True
)
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