當前位置: 首頁>>代碼示例>>Python>>正文


Python utils.PaastaCheckMessages類代碼示例

本文整理匯總了Python中paasta_tools.cli.utils.PaastaCheckMessages的典型用法代碼示例。如果您正苦於以下問題:Python PaastaCheckMessages類的具體用法?Python PaastaCheckMessages怎麽用?Python PaastaCheckMessages使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了PaastaCheckMessages類的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: git_repo_check

def git_repo_check(service):
    git_url = get_git_url(service)
    cmd = 'git ls-remote %s' % git_url
    returncode, _ = _run(cmd, timeout=5)
    if returncode == 0:
        print PaastaCheckMessages.GIT_REPO_FOUND
    else:
        print PaastaCheckMessages.git_repo_missing(git_url)
開發者ID:seco,項目名稱:paasta,代碼行數:8,代碼來源:check.py

示例2: service_dir_check

def service_dir_check(service, soa_dir):
    """Check whether directory service exists in /nail/etc/services
    :param service: string of service name we wish to inspect
    """
    try:
        validate_service_name(service, soa_dir)
        print PaastaCheckMessages.service_dir_found(service, soa_dir)
    except NoSuchService:
        print PaastaCheckMessages.service_dir_missing(service, soa_dir)
開發者ID:seco,項目名稱:paasta,代碼行數:9,代碼來源:check.py

示例3: sensu_check

def sensu_check(service, service_path, soa_dir):
    """Check whether monitoring.yaml exists in service directory,
    and that the team name is declared.

    :param service: name of service currently being examined
    :param service_path: path to loction of monitoring.yaml file"""
    if is_file_in_dir('monitoring.yaml', service_path):
        print PaastaCheckMessages.SENSU_MONITORING_FOUND
        team = get_team(service=service, overrides={}, soa_dir=soa_dir)
        if team is None:
            print PaastaCheckMessages.SENSU_TEAM_MISSING
        else:
            print PaastaCheckMessages.sensu_team_found(team)
    else:
        print PaastaCheckMessages.SENSU_MONITORING_MISSING
開發者ID:seco,項目名稱:paasta,代碼行數:15,代碼來源:check.py

示例4: smartstack_check

def smartstack_check(service, service_path):
    """Check whether smartstack.yaml exists in service directory, and the proxy
    ports are declared.  Print appropriate message depending on outcome.

    :param service: name of service currently being examined
    :param service_path: path to loction of smartstack.yaml file"""
    if is_file_in_dir('smartstack.yaml', service_path):
        print PaastaCheckMessages.SMARTSTACK_YAML_FOUND
        instances = get_all_namespaces_for_service(service)
        if len(instances) > 0:
            for namespace, config in get_all_namespaces_for_service(service, full_name=False):
                if 'proxy_port' in config:
                    print PaastaCheckMessages.smartstack_port_found(
                        namespace, config.get('proxy_port'))
                else:
                    print PaastaCheckMessages.SMARTSTACK_PORT_MISSING
        else:
            print PaastaCheckMessages.SMARTSTACK_PORT_MISSING
開發者ID:yanyanqin,項目名稱:paasta,代碼行數:18,代碼來源:check.py

示例5: test_check_service_dir_check_pass

def test_check_service_dir_check_pass(mock_stdout, mock_validate_service_name):
    mock_validate_service_name.return_value = None
    service = 'fake_service'
    expected_output = \
        "%s\n" % PaastaCheckMessages.service_dir_found(service)
    service_dir_check(service)
    output = mock_stdout.getvalue()

    assert output == expected_output
開發者ID:sayi21cn,項目名稱:paasta,代碼行數:9,代碼來源:test_cmds_check.py

示例6: test_check_service_dir_check_fail

def test_check_service_dir_check_fail(mock_stdout, mock_validate_service_name):
    service = 'fake_service'
    mock_validate_service_name.side_effect = NoSuchService(service)
    expected_output = "%s\n" \
                      % PaastaCheckMessages.service_dir_missing(service)
    service_dir_check(service)
    output = mock_stdout.getvalue()

    assert output == expected_output
開發者ID:sayi21cn,項目名稱:paasta,代碼行數:9,代碼來源:test_cmds_check.py

示例7: test_check_sensu_check_pass

def test_check_sensu_check_pass(mock_stdout, mock_get_team,
                                mock_is_file_in_dir):
    # monitoring.yaml exists and team is found

    mock_is_file_in_dir.return_value = "/fake/path"
    team = 'team-service-infra'
    mock_get_team.return_value = team
    expected_output = "%s\n%s\n" % (PaastaCheckMessages.SENSU_MONITORING_FOUND,
                                    PaastaCheckMessages.sensu_team_found(team))

    sensu_check('fake_service', 'path')
    output = mock_stdout.getvalue()

    assert output == expected_output
    mock_get_team.assert_called_once_with(service='fake_service', overrides={})
開發者ID:iomedhealth,項目名稱:paasta,代碼行數:15,代碼來源:test_cmds_check.py

示例8: test_check_smartstack_check_pass

def test_check_smartstack_check_pass(mock_stdout, mock_is_file_in_dir,
                                     mock_read_service_info):
    # smartstack.yaml exists and port is found

    mock_is_file_in_dir.return_value = True
    port = 80
    instance = 'main'
    smartstack_dict = {
        'smartstack': {
            instance: {
                'proxy_port': port
            }
        }
    }
    mock_read_service_info.return_value = smartstack_dict
    expected_output = "%s\n%s\n" \
                      % (PaastaCheckMessages.SMARTSTACK_YAML_FOUND,
                         PaastaCheckMessages.smartstack_port_found(
                             instance, port))

    smartstack_check('fake_service', 'path')
    output = mock_stdout.getvalue()

    assert output == expected_output
開發者ID:iomedhealth,項目名稱:paasta,代碼行數:24,代碼來源:test_cmds_check.py


注:本文中的paasta_tools.cli.utils.PaastaCheckMessages類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。