Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
caucase
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
Boxiang Sun
caucase
Commits
7a09ecac
Commit
7a09ecac
authored
May 29, 2017
by
Alain Takoudjou
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add support for backup caucase database to cli
parent
5f6857b7
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
21 deletions
+20
-21
caucase/cli.py
caucase/cli.py
+19
-21
setup.py
setup.py
+1
-0
No files found.
caucase/cli.py
View file @
7a09ecac
...
...
@@ -16,34 +16,32 @@
# You should have received a copy of the GNU General Public License
# along with caucase. If not, see <http://www.gnu.org/licenses/>.
import
os
import
argparse
from
caucase.web
import
app
,
db
from
caucase
import
app
,
db
from
flask_alchemydumps
import
AlchemyDumps
,
AlchemyDumpsCommand
from
flask_script
import
Manager
,
Command
def
parseArguments
():
"""
Parse arguments for Certificate Authority cli instance.
"""
parser
=
argparse
.
ArgumentParser
()
parser
.
add_argument
(
'-f'
,
'--db-file'
,
required
=
True
,
help
=
'Certificate authority data base file path'
)
return
parser
def
housekeeping
(
config
):
app
.
config
.
update
(
DEBUG
=
False
,
CSRF_ENABLED
=
True
,
TESTING
=
False
,
SQLALCHEMY_DATABASE_URI
=
'sqlite:///%sca.db'
%
os
.
environ
.
get
(
'CAUCASE_DIR'
,
''
)
)
manager
=
Manager
(
app
)
# init Alchemy Dumps
alchemydumps
=
AlchemyDumps
(
app
,
db
)
manager
.
add_command
(
'database'
,
AlchemyDumpsCommand
)
@
manager
.
command
def
housekeep
():
"""
Start Storage housekeep method to cleanup garbages
"""
app
.
config
.
update
(
DEBUG
=
False
,
CSRF_ENABLED
=
True
,
TESTING
=
False
,
SQLALCHEMY_DATABASE_URI
=
'sqlite:///%s'
%
config
.
db_file
)
from
caucase.storage
import
Storage
storage
=
Storage
(
db
)
storage
.
housekeep
()
def
main
():
parser
=
parseArguments
()
config
=
parser
.
parse_args
()
housekeeping
(
config
)
\ No newline at end of file
manager
.
run
()
setup.py
View file @
7a09ecac
...
...
@@ -52,6 +52,7 @@ setup(name=name,
install_requires
=
[
'Flask'
,
# needed by servers
'flask_user'
,
'Flask-AlchemyDumps'
,
'setuptools'
,
# namespaces
'pyOpenSSL'
,
# manage ssl certificates
'pyasn1'
,
# ASN.1 types and codecs for certificates
...
...
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