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
isaak yansane-sisk
slapos
Commits
71e3b7c2
Commit
71e3b7c2
authored
Oct 25, 2011
by
Antoine Catton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Final improvement of mydumper
parent
82f3ee6a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
48 additions
and
13 deletions
+48
-13
slapos/recipe/mydumper.py
slapos/recipe/mydumper.py
+48
-13
No files found.
slapos/recipe/mydumper.py
View file @
71e3b7c2
...
...
@@ -29,20 +29,53 @@ import subprocess
from
slapos.recipe.librecipe
import
GenericBaseRecipe
def
dump
(
args
):
mydumper_binary
=
args
[
'mydumper'
]
database
=
args
[
'database'
]
socket
=
args
[
'socket'
]
directory
=
args
[
'directory'
]
mydumper_cmd
=
[
mydumper_binary
,
'-B'
,
database
,
'-u'
,
'root'
,
'-S'
,
socket
,
'-o'
,
directory
,
]
mydumper_cmd
=
[
args
[
'mydumper'
]]
mydumper_cmd
.
extend
([
'-B'
,
args
[
'database'
]])
if
args
[
'socket'
]
is
not
None
:
mydumper_cmd
.
extend
([
'-S'
,
args
[
'socket'
]])
else
:
mydumper_cmd
.
extend
([
'-h'
,
args
[
'host'
]])
mydumper_cmd
.
etxned
([
'-P'
,
args
[
'port'
]])
mydumper_cmd
.
extend
([
'-u'
,
args
[
'user'
]])
if
args
[
'password'
]
is
not
None
:
mydumper_cmd
.
extend
([
'-p'
,
args
[
'password'
]])
if
args
[
'compression'
]:
mydumper_cmd
.
append
(
'--compress'
)
if
args
[
'rows'
]
is
not
None
:
mydumper_cmd
.
extend
([
'-r'
,
args
[
'rows'
]])
mydumper_cmd
.
extend
([
'-o'
,
args
[
'directory'
]])
subprocess
.
check_call
(
mydumper_cmd
)
def
do_import
(
args
):
mydumper_cmd
=
[
args
[
'mydumper'
]]
mydumper_cmd
.
extend
([
'-B'
,
args
[
'database'
]])
if
args
[
'socket'
]
is
not
None
:
mydumper_cmd
.
extend
([
'-S'
,
args
[
'socket'
]])
else
:
mydumper_cmd
.
extend
([
'-h'
,
args
[
'host'
]])
mydumper_cmd
.
etxned
([
'-P'
,
args
[
'port'
]])
mydumper_cmd
.
extend
([
'-u'
,
args
[
'user'
]])
if
args
[
'password'
]
is
not
None
:
mydumper_cmd
.
extend
([
'-p'
,
args
[
'password'
]])
mydumper_cmd
.
append
(
'--overwrite-tables'
)
mydumper_cmd
.
extend
([
'-d'
,
args
[
'directory'
]])
subprocess
.
check_call
(
mydumper_cmd
)
class
Recipe
(
GenericBaseRecipe
):
def
install
(
self
):
...
...
@@ -59,7 +92,6 @@ class Recipe(GenericBaseRecipe):
directory
=
self
.
options
[
'backup-directory'
],
user
=
self
.
options
[
'user'
],
password
=
self
.
options
.
get
(
'password'
),
compression
=
self
.
optionIsTrue
(
'compression'
,
default
=
False
)
)
name
=
__name__
...
...
@@ -67,7 +99,10 @@ class Recipe(GenericBaseRecipe):
config
.
update
(
mydumper
=
self
.
options
[
'myloader-binary'
])
name
+=
'.do_import'
else
:
config
.
update
(
mydumper
=
self
.
options
[
'mydumper-binary'
])
config
.
update
(
mydumper
=
self
.
options
[
'mydumper-binary'
],
compression
=
self
.
optionIsTrue
(
'compression'
,
default
=
False
),
rows
=
self
.
options
.
get
(
'rows'
),
)
name
+=
'.dump'
wrapper
=
self
.
createPythonScript
(
self
.
options
[
'wrapper'
],
...
...
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