mirror of
https://github.com/yavook/kiwi-scp.git
synced 2025-03-19 19:03:00 +00:00
37 lines
1,006 B
Python
37 lines
1,006 B
Python
from ..projects import Projects
|
|
from ..subcommand import SubCommand
|
|
|
|
|
|
class CleanCommand(SubCommand):
|
|
"""kiwi clean"""
|
|
|
|
def __init__(self):
|
|
super().__init__(
|
|
'clean',
|
|
action="Cleaning all configs for",
|
|
description="Cleanly sync all configs to target folder, then relaunch affected projects"
|
|
)
|
|
|
|
def _run_instance(self, runner, args):
|
|
result = True
|
|
|
|
affected_projects = [
|
|
project.get_name()
|
|
for project in Projects.from_dir()
|
|
if project.has_configs()
|
|
]
|
|
|
|
for project_name in affected_projects:
|
|
args.projects = project_name
|
|
result &= runner.run('down')
|
|
|
|
# cleanly sync configs
|
|
result &= runner.run('conf-purge')
|
|
result &= runner.run('conf-copy')
|
|
|
|
# bring projects back up
|
|
for project_name in affected_projects:
|
|
args.projects = project_name
|
|
result &= runner.run('up')
|
|
|
|
return result
|