summaryrefslogtreecommitdiffstats
path: root/qtip/runner/project.py
blob: a06172287d383bd1ab7060078af37ad53bf13b98 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
##############################################################################
# Copyright (c) 2017 ZTE corp. and others.
#
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Apache License, Version 2.0
# which accompanies this distribution, and is available at
# http://www.apache.org/licenses/LICENSE-2.0
##############################################################################

import os


def convert(vals):
    if vals:
        return " ".join(vals)


ARGS = 'ansible-playbook {}.yml {}'
NO_ARGS = 'ansible-playbook {}.yml'


def setup(extra_val):
    if extra_val:
        os.system(ARGS.format('setup', convert(extra_val)))
    else:
        os.system(NO_ARGS.format('setup'))


def run(extra_val):
    if extra_val:
        os.system(ARGS.format('run', convert(extra_val)))
    else:
        os.system(NO_ARGS.format('run'))


def teardown(extra_val):
    if extra_val:
        os.system(ARGS.format('teardown', convert(extra_val)))
    else:
        os.system(NO_ARGS.format('teardown'))