Example #1
0
    SERVICES_INITD = ['redis_6379', 'postgresql', 'nginx', 'firewall']
    SERVICES_UPSTART = [
        'gunicorn', 'celery-worker', 'celery-beat', 'celery-flower', 'django'
    ]
    SERVICES_DEV = SERVICES_INITD + [
        s + "-development" for s in SERVICES_UPSTART
    ]
    SERVICES_STG = SERVICES_INITD + [s + "-staging" for s in SERVICES_UPSTART]
    SERVICES_PRD = SERVICES_INITD + [
        s + "-production" for s in SERVICES_UPSTART
    ]

    q = Questionnaire()

    # ENV
    q.add_question('env', options=['development', 'staging', 'production'])

    # KIND
    q.add_question('kind', options=['deploy', 'service'])

    # PLAYBOOKS
    q.add_question('playbooks', prompter="multiple",
        options=['deploy', 'webserver', 'database', 'backend', 'webapp', 'api', 'message', 'staticfiles', 'create_user',]).\
        add_condition(keys=['kind'], vals=['deploy'])

    q.add_question('playbooks', prompter="multiple",
        options=['service', 'webserver', 'database', 'webapp', 'api', 'message',]).\
        add_condition(keys=['kind'], vals=['service'])

    # TAGS
    q.add_question('tags', prompter="multiple",
        command += " --extra-vars=\"{}\"".format(extra_vars)
    return command


if __name__ == '__main__':

    SERVICES_INITD = ['redis_6379', 'postgresql', 'nginx', 'firewall']
    SERVICES_UPSTART = ['gunicorn', 'celery-worker', 'celery-beat', 'celery-flower', 'django']
    SERVICES_DEV = SERVICES_INITD + [s + "-development" for s in SERVICES_UPSTART]
    SERVICES_STG = SERVICES_INITD + [s + "-staging" for s in SERVICES_UPSTART]
    SERVICES_PRD = SERVICES_INITD + [s + "-production" for s in SERVICES_UPSTART]

    q = Questionnaire()

    # ENV
    q.add_question('env', options=['development', 'staging', 'production'])

    # KIND
    q.add_question('kind', options=['deploy', 'service'])

    # PLAYBOOKS
    q.add_question('playbooks', prompter="multiple",
        options=['deploy', 'webserver', 'database', 'backend', 'webapp', 'api', 'message', 'staticfiles', 'create_user',]).\
        add_condition(keys=['kind'], vals=['deploy'])

    q.add_question('playbooks', prompter="multiple",
        options=['service', 'webserver', 'database', 'webapp', 'api', 'message',]).\
        add_condition(keys=['kind'], vals=['service'])

    # TAGS
    q.add_question('tags', prompter="multiple",
Example #3
0
from questionnaire import Questionnaire

q = Questionnaire()
q.add_question('age', prompter="raw", prompt='How old are you?', type=int)

# youngsters (age less than or equal to 18)
q.add_question('plans', prompt="Where do you want to go to school?", options=['Valley College', 'La Escuela de Calor']).\
    add_condition(keys=['age'], vals=[18], operators=['<='])
q.add_question('plans', prompt="Where do you want to work?", options=['On a farm', 'In an office', 'On the couch']).\
    add_condition(keys=['age'], vals=[40], operators=['<='])
q.add_question('plans', prompt="Where do you want to vacation?", options=['El Caribe', 'On a cruise ship', 'Las Islas Canarias']).\
    add_condition(keys=['age'], vals=[60], operators=['<='])
# old folks (more than 60 years old)
q.add_question('plans', prompt="Where do you want to retire?", options=['El campo', 'The beach', 'San Miguel de Allende'])

answers = q.run()
print(answers)
Example #4
0
from questionnaire import Questionnaire

q = Questionnaire()
q.add_question('day', options=['monday', 'friday', 'saturday'])
q.add_question('time', options=['morning', 'night'])

# nights
q.add_question('activities', prompter='multiple', options=['eat tacos de pastor', 'go to the cantina', 'do some programming']).\
    add_condition(keys=['time'], vals=['night'])
# saturday morning
q.add_question('activities', prompter='multiple', options=['eat barbacoa', 'watch footy match', 'walk the dog']).\
    add_condition(keys=['day', 'time'], vals=['saturday', 'morning'])
# other mornings
q.add_question('activities', prompter='multiple', options=['eat granola', 'get dressed', 'go to work']).\
    add_condition(keys=['time'], vals=['morning'])

answers = q.run()
print(answers)