Ejemplo n.º 1
0
def when_i_try_to_log_in_agent_through_xivoagentctl(step, agent, extension):
    number, context = extension.split('@')
    command = [
        'xivo-agentctl', '-c',
        '"login %s %s %s"' % (agent, number, context)
    ]
    sysutils.send_command(command)
Ejemplo n.º 2
0
def _configure_ca_certificate():
    command = ['grep', 'TLS_CACERT', '/etc/ldap/ldap.conf']
    output = sysutils.output_command(command)
    if not output.strip():
        command = [
            "echo 'TLS_CACERT /etc/ssl/certs/ca-certificates.crt' >> /etc/ldap/ldap.conf"
        ]
        sysutils.send_command(command)
Ejemplo n.º 3
0
def then_moh_files_owned_by_asterisk_www_data(step):
    command = ["apt-get", "install", "-y", "asterisk-moh-opsound-wav"]
    sysutils.send_command(command)
    text = sysutils.get_list_file(MOH_PATH)
    lines = text.split("\n")
    for line in lines:
        if line:
            file = "%s/%s" % (MOH_PATH, line.strip())
            assert sysutils.file_owned_by_user(file, "asterisk")
            assert sysutils.file_owned_by_group(file, "www-data")
Ejemplo n.º 4
0
def then_moh_files_owned_by_asterisk_www_data(step):
    command = ['apt-get', 'install', '-y', 'asterisk-moh-opsound-wav']
    sysutils.send_command(command)
    text = sysutils.get_list_file(MOH_PATH)
    lines = text.split("\n")
    for line in lines:
        if line:
            file = '%s/%s' % (MOH_PATH, line.strip())
            assert sysutils.file_owned_by_user(file, 'asterisk')
            assert sysutils.file_owned_by_group(file, 'www-data')
Ejemplo n.º 5
0
def given_there_is_a_config_file_group1(step, config_file_name):
    config_file_full_path = '/etc/asterisk/extensions_extra.d/%s' % config_file_name
    sysutils.send_command(['touch', config_file_full_path])
    sysutils.send_command(['echo', '[section]', '>', config_file_full_path])
    sysutils.send_command(
        ['chown', 'asterisk:www-data', config_file_full_path])
    sysutils.send_command(['chmod', '660', config_file_full_path])
Ejemplo n.º 6
0
def then_backup_files_successfully_rotated(step):
    command = ['rm', '-f', '%s/*' % BACKUP_DIR]
    sysutils.send_command(command)
    command = ['touch', '%s/data.tgz' % BACKUP_DIR]
    sysutils.send_command(command)
    command = ['touch', '%s/db.tgz' % BACKUP_DIR]
    sysutils.send_command(command)
    command = ['/usr/sbin/logrotate', '-f', '/etc/logrotate.d/xivo-backup']
    sysutils.send_command(command)

    expected_files = ['data.tgz', 'data.tgz.1', 'db.tgz', 'db.tgz.1']
    for expected_file in expected_files:
        assert sysutils.path_exists('%s/%s' % (BACKUP_DIR, expected_file))

    command = ['/usr/sbin/logrotate', '-f', '/etc/logrotate.d/xivo-backup']
    sysutils.send_command(command)

    expected_files.extend(['data.tgz.2', 'db.tgz.2'])
    for expected_file in expected_files:
        assert sysutils.path_exists('%s/%s' % (BACKUP_DIR, expected_file))
Ejemplo n.º 7
0
def then_backup_files_successfully_rotated(step):
    command = ["rm", "-f", "%s/*" % BACKUP_DIR]
    sysutils.send_command(command)
    command = ["touch", "%s/data.tgz" % BACKUP_DIR]
    sysutils.send_command(command)
    command = ["touch", "%s/db.tgz" % BACKUP_DIR]
    sysutils.send_command(command)
    command = ["/usr/sbin/logrotate", "-f", "/etc/logrotate.d/xivo-backup"]
    sysutils.send_command(command)

    expected_files = ["data.tgz", "data.tgz.1", "db.tgz", "db.tgz.1"]
    for expected_file in expected_files:
        assert sysutils.path_exists("%s/%s" % (BACKUP_DIR, expected_file))

    command = ["/usr/sbin/logrotate", "-f", "/etc/logrotate.d/xivo-backup"]
    sysutils.send_command(command)

    expected_files.extend(["data.tgz.2", "db.tgz.2"])
    for expected_file in expected_files:
        assert sysutils.path_exists("%s/%s" % (BACKUP_DIR, expected_file))
Ejemplo n.º 8
0
def when_i_generate_call_logs_using_the_last_unprocessed_1_cel_entries(step, cel_count):
    command = ['xivo-call-logs', '-c', cel_count]
    sysutils.send_command(command)
Ejemplo n.º 9
0
def when_i_generate_call_logs(step):
    command = ['xivo-call-logs']
    sysutils.send_command(command)
Ejemplo n.º 10
0
def given_the_provisioning_plugin_cache_has_been_cleared(step):
    sysutils.send_command(['rm', '-f', '/var/cache/xivo-provd/*'])
Ejemplo n.º 11
0
def then_asterisk_command_group1_return_no_error(step, ast_cmd):
    command = ['asterisk', '-rx', '"%s"' % ast_cmd]
    assert sysutils.send_command(command)
Ejemplo n.º 12
0
def when_i_reload_the_module(step, module):
    ast_cmd = 'module reload %s' % module
    command = ['asterisk', '-rx', '"%s"' % ast_cmd]
    assert sysutils.send_command(command)
    time.sleep(3)
Ejemplo n.º 13
0
def given_the_provisioning_plugin_cache_has_been_cleared(step):
    sysutils.send_command(['rm', '-f', '/var/cache/xivo-provd/*'])
Ejemplo n.º 14
0
def when_i_generate_call_logs_using_the_last_unprocessed_1_cel_entries(
        step, cel_count):
    command = ['xivo-call-logs', '-c', cel_count]
    sysutils.send_command(command)
Ejemplo n.º 15
0
def when_i_generate_call_logs(step):
    command = ['xivo-call-logs']
    sysutils.send_command(command)
Ejemplo n.º 16
0
def when_i_reload_the_module(step, module):
    ast_cmd = 'module reload %s' % module
    command = ['asterisk', '-rx', '"%s"' % ast_cmd]
    assert sysutils.send_command(command)
    time.sleep(3)
Ejemplo n.º 17
0
def when_i_stop_asterisk(step):
    command = ['service', 'asterisk', 'stop']
    assert sysutils.send_command(command)
Ejemplo n.º 18
0
def then_asterisk_command_group1_return_no_error(step, ast_cmd):
    command = ['asterisk', '-rx', '"%s"' % ast_cmd]
    assert sysutils.send_command(command)
Ejemplo n.º 19
0
def when_i_stop_asterisk(step):
    command = ['service', 'asterisk', 'stop']
    assert sysutils.send_command(command)
Ejemplo n.º 20
0
def unlog_all_agents():
    sysutils.send_command(['xivo-agentctl', '-c', '"logoff all"'])
Ejemplo n.º 21
0
def when_i_try_to_log_in_agent_through_xivoagentctl(step, agent, extension):
    number, context = extension.split('@')
    command = ['xivo-agentctl', '-c', '"login %s %s %s"' % (agent, number, context)]
    sysutils.send_command(command)
Ejemplo n.º 22
0
def unpause_agent(agent_number):
    command = ['xivo-agentctl', '-c', '"unpause %s"' % agent_number]
    sysutils.send_command(command)
Ejemplo n.º 23
0
def _configure_ca_certificate():
    command = ['grep', 'TLS_CACERT', '/etc/ldap/ldap.conf']
    output = sysutils.output_command(command)
    if not output.strip():
        command = ["echo 'TLS_CACERT /etc/ssl/certs/ca-certificates.crt' >> /etc/ldap/ldap.conf"]
        sysutils.send_command(command)
Ejemplo n.º 24
0
def when_i_try_to_log_off_agent_through_xivoagentctl(step, agent):
    command = ['xivo-agentctl', '-c', '"logoff %s"' % agent]
    sysutils.send_command(command)
Ejemplo n.º 25
0
def when_i_try_to_log_off_agent_through_xivoagentctl(step, agent):
    command = ['xivo-agentctl', '-c', '"logoff %s"' % agent]
    sysutils.send_command(command)
Ejemplo n.º 26
0
def given_there_is_a_config_file_group1(step, config_file_name):
    config_file_full_path = '/etc/asterisk/extensions_extra.d/%s' % config_file_name
    sysutils.send_command(['touch', config_file_full_path])
    sysutils.send_command(['echo', '[section]', '>', config_file_full_path])
    sysutils.send_command(['chown', 'asterisk:www-data', config_file_full_path])
    sysutils.send_command(['chmod', '660', config_file_full_path])