1
0
Fork 0
mirror of https://github.com/yavook/kiwi-scp.git synced 2024-11-22 21:03:00 +00:00
kiwi-scp/src/kiwi/subcommands/update.py

35 lines
1,023 B
Python
Raw Normal View History

2020-08-18 12:37:07 +00:00
# local
from ._subcommand import FlexCommand
2020-08-18 13:05:19 +00:00
from .utils.misc import are_you_sure
2020-08-18 12:37:07 +00:00
class UpdateCommand(FlexCommand):
"""kiwi update"""
def __init__(self):
super().__init__(
'update', "Updating",
description="Update the whole instance, a project or service(s) inside a project"
)
2020-08-18 13:05:19 +00:00
def _run_instance(self, runner, config, args):
if are_you_sure([
"This will update the entire instance at once.",
"",
"This is probably not what you intended, because:",
" - Updates may take a long time",
" - Updates may break beloved functionality",
]):
return super()._run_instance(runner, config, args)
return False
2020-08-18 12:37:07 +00:00
def _run_services(self, runner, config, args, services):
result = runner.run('build')
result &= runner.run('pull')
result &= runner.run('conf-copy')
result &= runner.run('down')
result &= runner.run('up')
return result