Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
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
Carlos Ramos Carreño
erp5
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
Show 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
os
import
subprocess
import
subprocess
import
time
import
time
...
@@ -16,35 +18,39 @@ def updateMysql(mysql_upgrade_binary, mysql_binary, mysql_script_file):
...
@@ -16,35 +18,39 @@ def updateMysql(mysql_upgrade_binary, mysql_binary, mysql_script_file):
while
True
:
while
True
:
while
True
:
while
True
:
mysql_upgrade
=
subprocess
.
Popen
(
mysql_upgrade_binary
,
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
]
result
=
mysql_upgrade
.
communicate
()[
0
]
if
mysql_upgrade
.
returncode
:
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
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
,
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
]
result
=
mysql
.
communicate
(
mysql_script
)[
0
]
if
mysql
.
returncode
:
if
mysql
.
returncode
:
print
'Command %r failed with:
\
n
%s'
%
(
mysql_list
,
result
)
print
(
'Command %r failed with:
\
n
%s'
%
(
mysql_list
,
result
)
)
break
break
# import timezone database
# import timezone database
mysql_tzinfo_to_sql
=
subprocess
.
Popen
(
mysql_tzinfo_to_sql_list
,
stdin
=
subprocess
.
PIPE
,
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
]
timezone_sql
=
mysql_tzinfo_to_sql
.
communicate
()[
0
]
if
mysql_tzinfo_to_sql
.
returncode
!=
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
break
mysql
=
subprocess
.
Popen
(
mysql_list
+
(
'mysql'
,),
stdin
=
subprocess
.
PIPE
,
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
]
result
=
mysql
.
communicate
(
timezone_sql
)[
0
]
if
mysql
.
returncode
:
if
mysql
.
returncode
:
print
'Command %r failed with:
\
n
%s'
%
(
mysql_list
,
result
)
print
(
'Command %r failed with:
\
n
%s'
%
(
mysql_list
,
result
)
)
break
break
print
'SlapOS initialisation script succesfully applied on database.'
print
(
'SlapOS initialisation script succesfully applied on database.'
)
return
return
sleep
=
min
(
sleep
+
1
,
30
)
sleep
=
min
(
sleep
+
1
,
30
)
print
'Sleeping for %ss and retrying'
%
sleep
print
(
'Sleeping for %ss and retrying'
%
sleep
)
sys
.
stdout
.
flush
()
sys
.
stdout
.
flush
()
sys
.
stderr
.
flush
()
sys
.
stderr
.
flush
()
time
.
sleep
(
sleep
)
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