コード例 #1
0
def show_platform_events(follow, version):
    platform_name = fileoperations.get_platform_name()

    if version is None:
        version = fileoperations.get_platform_version()

        if version is None:
            raise InvalidPlatformVersionError(
                strings['exit.nosuchplatformversion'])

        platform = _get_platform(platform_name,
                                 version,
                                 owner=Constants.OWNED_BY_SELF)

        if platform is None:
            raise InvalidPlatformVersionError(
                strings['exit.nosuchplatformversion'])

        arn = platform['PlatformArn']
    else:
        arn = _version_to_arn(version)

    if arn is None:
        raise InvalidPlatformVersionError(
            strings['exit.nosuchplatformversion'])

    print_events(follow=follow, platform_arn=arn, app_name=None, env_name=None)
コード例 #2
0
def show_platform_events(follow, version):
    platform_name = fileoperations.get_platform_name()

    if version is None:
        version = fileoperations.get_platform_version()

        if version is None:
            raise InvalidPlatformVersionError(strings['exit.nosuchplatformversion'])

        platform = describe_custom_platform_version(
            platform_name=platform_name,
            platform_version=version,
            owner=Constants.OWNED_BY_SELF
        )

        if platform is None:
            raise InvalidPlatformVersionError(strings['exit.nosuchplatformversion'])

        arn = platform['PlatformArn']
    else:
        arn = _version_to_arn(version)

    print_events(follow=follow, platform_arn=arn, app_name=None, env_name=None)
コード例 #3
0
    def test_print_events(self, get_new_events_mock, echo_with_pager_mock):
        get_new_events_mock.return_value = Event.json_to_event_objects([{
            'EventDate':
            datetime.datetime(2018,
                              7,
                              19,
                              21,
                              50,
                              21,
                              623000,
                              tzinfo=tz.tzutc()),
            'Message':
            'Successfully launched environment: eb-locust-example-windows-server-dev',
            'ApplicationName':
            'eb-locust-example-windows-server',
            'EnvironmentName':
            'eb-locust-example-windows-server-dev',
            'RequestId':
            'a28c2685-b6a0-4785-82bf-45de6451bd01',
            'Severity':
            'INFO'
        }, {
            'EventDate':
            datetime.datetime(2018,
                              7,
                              19,
                              21,
                              50,
                              0,
                              909000,
                              tzinfo=tz.tzutc()),
            'Message':
            'Environment health has transitioned from Pending to Ok. Initialization completed 26 seconds ago and took 5 minutes.',
            'ApplicationName':
            'eb-locust-example-windows-server',
            'EnvironmentName':
            'eb-locust-example-windows-server-dev',
            'Severity':
            'INFO'
        }, {
            'EventDate':
            datetime.datetime(2018, 7, 19, 21, 49, 10, tzinfo=tz.tzutc()),
            'Message':
            "Nginx configuration detected in the '.ebextensions/nginx' directory. AWS Elastic Beanstalk will no longer manage the Nginx configuration for this environment.",
            'ApplicationName':
            'eb-locust-example-windows-server',
            'EnvironmentName':
            'eb-locust-example-windows-server-dev',
            'RequestId':
            'a28c2685-b6a0-4785-82bf-45de6451bd01',
            'Severity':
            'INFO'
        }])

        eventsops.print_events('my-application', 'environment-1', False)

        get_new_events_mock.assert_called_once_with('my-application',
                                                    'environment-1',
                                                    None,
                                                    platform_arn=None)
        echo_with_pager_mock.assert_called_once_with(
            os.linesep.join([
                "2018-07-19 21:49:10    INFO    Nginx configuration detected in the '.ebextensions/nginx' directory. AWS Elastic Beanstalk will no longer manage the Nginx configuration for this environment.",
                '2018-07-19 21:50:00    INFO    Environment health has transitioned from Pending to Ok. Initialization completed 26 seconds ago and took 5 minutes.',
                '2018-07-19 21:50:21    INFO    Successfully launched environment: eb-locust-example-windows-server-dev',
            ]))
コード例 #4
0
    def test_print_events__follow_events(self, follow_events_mock):
        eventsops.print_events('my-application', 'environment-1', True)

        follow_events_mock.assert_called_once_with('my-application',
                                                   'environment-1', None)
コード例 #5
0
ファイル: events.py プロジェクト: cmurphy580/PyJobSearch
    def do_command(self):
        app_name = self.get_app_name()
        env_name = self.get_env_name()
        follow = self.app.pargs.follow

        eventsops.print_events(app_name, env_name, follow)