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

docker_service: defined cpus does not get casted into float #30548

Closed
yajo opened this issue Sep 19, 2017 · 14 comments
Closed

docker_service: defined cpus does not get casted into float #30548

yajo opened this issue Sep 19, 2017 · 14 comments
Labels
affects_2.3 This issue/PR affects Ansible v2.3 bug This issue/PR relates to a bug. cloud docker module This issue/PR relates to a module. needs_info This issue requires further information. Please answer any outstanding questions. support:community This issue/PR relates to code supported by the Ansible community.

Comments

@yajo
Copy link
Contributor

yajo commented Sep 19, 2017

ISSUE TYPE
  • Bug Report
COMPONENT NAME

docker_service

ANSIBLE VERSION
ansible 2.3.2.0
  configured module search path = Default w/o overrides
  python version = 2.7.13 (default, Sep  5 2017, 08:53:59) [GCC 7.1.1 20170622 (Red Hat 7.1.1-3)]
CONFIGURATION

Nothing

OS / ENVIRONMENT

N/A

SUMMARY

Defining a service and trying to calculate the cpus parameter fails with:

Configuration error - The Compose file '/tmp/ansibled30aTJ/docker-compose.yml' is invalid because:
Unsupported config option for services.dind: 'cpus'

Possibly related to #17992.

STEPS TO REPRODUCE
- docker_service:
    pull: true
    state: present
    project_name: test
    definition:
      version: "2.2"
      services:
        dind:
          image: docker:dind
          cpus: "{{ ansible_processor_cores / 2 }}"
EXPECTED RESULTS

The cpus parameter should get casted to float or Ansible should have a way to force that, as I explained in #15249 (comment).

ACTUAL RESULTS
    "msg": "Configuration error - The Compose file '/tmp/ansibled30aTJ/docker-compose.yml' is invalid because:\nUnsupported config option for services.dind: 'cpus'"
@ansibot
Copy link
Contributor

ansibot commented Sep 19, 2017

@ansibot ansibot added affects_2.3 This issue/PR affects Ansible v2.3 bug_report cloud docker module This issue/PR relates to a module. needs_triage Needs a first human triage before being processed. support:community This issue/PR relates to code supported by the Ansible community. labels Sep 19, 2017
@dagwieers
Copy link
Member

If 'cpus` is defined as a float in the argument_spec, this would not be a problem. I assume today it is defined as an int, or not specified at all ?

@ansibot ansibot removed the needs_triage Needs a first human triage before being processed. label Sep 19, 2017
@dagwieers
Copy link
Member

There is a light at the end of the tunnel. We made a change to Jinja2 so we don't see all variable types changed into strings. See: pallets/jinja#708

@s-hertel
Copy link
Contributor

Hopefully the fix to jinja2 gets merged soon. If someone needs a workaround I made a hackish fix for myself: s-hertel@559c498.

@ansibot ansibot added bug This issue/PR relates to a bug. and removed bug_report labels Mar 1, 2018
@yajo
Copy link
Contributor Author

yajo commented Jul 26, 2018

#32738 is merged now. How would that affect this issue at hand? Thanks.

@ansibot
Copy link
Contributor

ansibot commented Oct 6, 2018

@ansibot
Copy link
Contributor

ansibot commented Nov 2, 2018

@ansibot
Copy link
Contributor

ansibot commented Dec 12, 2018

@felixfontein
Copy link
Contributor

Please note that the docker_service module will be renamed to docker_compose in Ansible 2.8. You will be able to still use the old name, but you will receive a warning when doing so.

!component =lib/ansible/modules/cloud/docker/docker_compose.py

Also, please note that currently, nobody is actively maintaining the Ansible docker_service/docker_compose modules. If you are interested in working on this issue, please feel free to create a PR :) If you need any help, feel free to ping me or any other of the current docker_* module maintainers.

@ansibot
Copy link
Contributor

ansibot commented Feb 4, 2019

@ansibot
Copy link
Contributor

ansibot commented Apr 9, 2019

@ansibot ansibot added support:core This issue/PR relates to code supported by the Ansible Engineering Team. and removed module This issue/PR relates to a module. support:community This issue/PR relates to code supported by the Ansible community. labels Apr 17, 2019
@ansibot ansibot added module This issue/PR relates to a module. support:community This issue/PR relates to code supported by the Ansible community. and removed support:core This issue/PR relates to code supported by the Ansible Engineering Team. labels Apr 25, 2019
@sluther
Copy link
Contributor

sluther commented Jun 14, 2019

Can you confirm if this is still an issue or not after #32738 was merged?

needs_info

@ansibot ansibot added the needs_info This issue requires further information. Please answer any outstanding questions. label Jun 14, 2019
@ansibot
Copy link
Contributor

ansibot commented Jul 16, 2019

@yajo This issue is waiting for your response. Please respond or the issue will be closed.

click here for bot help

@yajo
Copy link
Contributor Author

yajo commented Jul 16, 2019

Sorry, yes it works fine with jinja2_native enabled. Thanks!

@yajo yajo closed this as completed Jul 16, 2019
@ansible ansible locked and limited conversation to collaborators Aug 13, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
affects_2.3 This issue/PR affects Ansible v2.3 bug This issue/PR relates to a bug. cloud docker module This issue/PR relates to a module. needs_info This issue requires further information. Please answer any outstanding questions. support:community This issue/PR relates to code supported by the Ansible community.
Projects
None yet
Development

No branches or pull requests

6 participants