Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding a switch to output docker logs #40693

Merged
merged 5 commits into from Jun 6, 2018

Conversation

achinthagunasekara
Copy link
Contributor

SUMMARY

Adding a switch to output docker logs optionally if selected to do so.

- name: Create container if required and run command.
  docker_container:
    name: yum_reposync
    image: "{{ reposync_container }}"
    detach: no
    volumes:
      - "/tmp/bootstrap.sh:/tmp/bootstrap.sh"
    entrypoint: /bin/bash /tmp/bootstrap.sh
    log_driver: "json-file"
    output_logs: 'yes'
ISSUE TYPE

Currently we are only able to see the logs of a container if the command, entrypoint task fails.
However it's worthwhile having the ability to view these logs optionally regardless.

@sambanks
Copy link

This would be great!

@ansibot
Copy link
Contributor

ansibot commented May 25, 2018

The test ansible-test sanity --test validate-modules [explain] failed with 1 error:

lib/ansible/modules/cloud/docker/docker_container.py:0:0: E309 version_added for new option (output_logs) should be 2.6. Currently 0.0

click here for bot help

@ansibot
Copy link
Contributor

ansibot commented May 25, 2018

@ansibot ansibot added affects_2.6 This issue/PR affects Ansible v2.6 ci_verified Changes made in this PR are causing tests to fail. cloud docker module This issue/PR relates to a module. needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. needs_triage Needs a first human triage before being processed. new_contributor This PR is the first contribution by a new community member. support:community This issue/PR relates to code supported by the Ansible community. labels May 25, 2018
@ansibot ansibot added community_review In order to be merged, this PR must follow the community review workflow. and removed ci_verified Changes made in this PR are causing tests to fail. needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. labels May 25, 2018
@mkrizek mkrizek removed the needs_triage Needs a first human triage before being processed. label May 25, 2018
@ansibot ansibot added the stale_ci This PR has been tested by CI more than one week ago. Close and re-open this PR to get it retested. label Jun 2, 2018
@ansibot ansibot removed the stale_ci This PR has been tested by CI more than one week ago. Close and re-open this PR to get it retested. label Jun 4, 2018
@ansibot
Copy link
Contributor

ansibot commented Jun 4, 2018

The test ansible-test sanity --test validate-modules [explain] failed with 1 error:

lib/ansible/modules/cloud/docker/docker_container.py:0:0: E309 version_added for new option (output_logs) should be 2.7. Currently 2.6

click here for bot help

@ansibot ansibot added ci_verified Changes made in this PR are causing tests to fail. needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. and removed community_review In order to be merged, this PR must follow the community review workflow. labels Jun 4, 2018
@ansibot ansibot added community_review In order to be merged, this PR must follow the community review workflow. and removed ci_verified Changes made in this PR are causing tests to fail. needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. labels Jun 4, 2018
@achinthagunasekara
Copy link
Contributor Author

ready_for_review

@achinthagunasekara
Copy link
Contributor Author

@mkrizek I have tried using ready_for_review on this PR.
Is there anything I need to have this reviewed?

Thanks

@@ -2022,6 +2034,7 @@ def main():
oom_killer=dict(type='bool'),
oom_score_adj=dict(type='int'),
paused=dict(type='bool', default=False),
output_logs=dict(type='bool', default=False),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

move this before paused to make options alphabetically ordered?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kassiansun Updated and ready_for_review again.

@ansibot ansibot added needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. and removed community_review In order to be merged, this PR must follow the community review workflow. labels Jun 6, 2018
@achinthagunasekara
Copy link
Contributor Author

ready_for_review

@ansibot ansibot added community_review In order to be merged, this PR must follow the community review workflow. and removed needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. labels Jun 6, 2018
@mkrizek mkrizek merged commit d98c892 into ansible:devel Jun 6, 2018
@achinthagunasekara achinthagunasekara deleted the dev-archie-docker-output branch June 6, 2018 10:41
jacum pushed a commit to jacum/ansible that referenced this pull request Jun 26, 2018
* Adding a switch to print logs

* Update to docs

* Adding `version_added` for the new option

* Updating version added

* Moving `output_logs` before `paued` for alphabetically ordering.
@ansible ansible locked and limited conversation to collaborators Jun 11, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
affects_2.6 This issue/PR affects Ansible v2.6 cloud community_review In order to be merged, this PR must follow the community review workflow. docker module This issue/PR relates to a module. new_contributor This PR is the first contribution by a new community member. support:community This issue/PR relates to code supported by the Ansible community.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants