ansible-container
ansible-container copied to clipboard
Meta Dependancies return AttributeError: 'str' object has no attribute 'get'
ISSUE TYPE
- Bug Report
container.yml
version: "2"
#defaults:
settings:
conductor_base: ubuntu:xenial
services:
db:
from: mysql:5.7
volumes:
- "{{ DOCKER_DATA_ROOT }}/mysql/data:/var/lib/mysql"
environment:
MYSQL_ROOT_PASSWORD: "{{ COMMON_MYSQL_MIGRATE_PASS }}"
MYSQL_DATABASE: "{{ EDXAPP_MYSQL_DB_NAME }}"
MYSQL_USER: "{{ EDXAPP_MYSQL_USER }}"
MYSQL_PASSWORD: "{{ EDXAPP_MYSQL_PASSWORD }}"
mongo:
from: mongo:3.4
command: /entrypoint.sh mongod --auth
volumes:
- "{{ DOCKER_DATA_ROOT }}/mongo/data:/data/db"
roles:
- { role: docker-setup, gather_facts: no }
- common_vars
- mongo_docker
# Need to build our own for ES 0.9
es:
from: ubuntu:xenial # opensaas/edx-elasticsearch
command: ["/usr/share/elasticsearch/bin/elasticsearch","-f"]
volumes:
- "{{ DOCKER_DATA_ROOT }}/elasticsearch/data:/data"
roles:
- { role: docker-setup, gather_facts: no }
- common_vars
- elasticsearch
- { role: oraclejdk, tags: ['install:app-requirements'] }
memcache:
from: memcached:1.4.24
volumes:
- "{{ DOCKER_DATA_ROOT }}/memcache/data:/data"
nginx:
from: nginx
links:
- lms:lms
- cms:cms
# - xqueue:xqueue
- insights:insights
- analytics:analytics
volumes:
- "{{ DOCKER_DATA_ROOT }}:/edx/var"
command: |
/bin/bash -c "nginx -g 'daemon off;'"
ports:
- 6080:80
- 6443:443
- 18000:18000
- 18010:18010
- 18020:18020
- 18040:18040
- 18100:18100
- 18110:18110
roles:
- { role: docker-setup, gather_facts: no }
- common_vars
- role: nginx
nginx_sites:
- cms
- lms
- analytics_api
- insights
- lms-preview
- xqueue
nginx_default_sites:
- lms
- cms
rabbitmq:
from: rabbitmq:3.5.3
volumes:
- "{{ DOCKER_DATA_ROOT }}/rabbitmq/data:/var/lib/rabbitmq"
environment:
RABBITMQ_DEFAULT_USER: "{{ EDXAPP_CELERY_USER }}"
RABBITMQ_DEFAULT_PASS: "{{ EDXAPP_CELERY_PASSWORD }}"
forums:
from: ubuntu:xenial #opensaas/edx-forums
links:
- db:db
# - xqueue:xqueue
- memcache:memcache
- mongo:mongo
- es:es
- rabbitmq:rabbitmq
command: ["/edx/app/supervisor/venvs/supervisor/bin/supervisord", "-n", "--configuration", "/edx/app/supervisor/supervisord.conf"]
depends_on:
- db
- memcache
- mongo
- es
- rabbitmq
volumes:
- "{{ DOCKER_EDX_ROOT }}/cs_comments_service:/edx/app/forum/cs_comments_service"
roles:
- { role: docker-setup, gather_facts: no }
- common_vars
- forum
# xqueue:
# from: ubuntu:xenial #opensaas/edx-xqueue
# links:
# - db:db
# - memcache:memcache
# - mongo:mongo
# - es:es
# - rabbitmq:rabbitmq
# command: ["/edx/app/supervisor/venvs/supervisor/bin/supervisord", "-n", "--configuration", "/edx/app/supervisor/supervisord.conf"]
# volumes:
# - "{{DOCKER_EDX_ROOT}}/xqueue:/edx/app/edxapp/xqueue"
# - /dev/log:/dev/log
lms:
from: ubuntu:xenial #opensaas/edxapp:trusty-v3
links:
- db:db
- forums:forums
# - xqueue:xqueue
- memcache:memcache
- mongo:mongo
- es:es
- rabbitmq:rabbitmq
command: ["/edx/app/supervisor/venvs/supervisor/bin/supervisord", "-n", "--configuration", "/edx/app/supervisor/supervisord.conf"]
depends_on:
- db
- memcache
- mongo
- es
- rabbitmq
volumes:
- "{{ DOCKER_EDX_ROOT }}/edx-platform:/edx/app/edxapp/edx-platform"
- /dev/log:/dev/log
- "{{ DOCKER_DATA_ROOT }}/edxapp:/edx/var/edxapp"
roles:
- { role: docker-setup, gather_facts: no }
- common_vars
- {role: edxapp, service_variants_enabled: ['lms'], migrate_db: 'no'}
cms:
from: ubuntu:xenial #opensaas/edxapp:trusty-v3
links:
- db:db
- forums:forums
# - xqueue:xqueue
- memcache:memcache
- mongo:mongo
- es:es
- rabbitmq:rabbitmq
command: ["/edx/app/supervisor/venvs/supervisor/bin/supervisord", "-n", "--configuration", "/edx/app/supervisor/supervisord.conf"]
depends_on:
- db
- memcache
- mongo
- es
- rabbitmq
volumes:
- "{{DOCKER_EDX_ROOT}}/edx-platform:/edx/app/edxapp/edx-platform"
- /dev/log:/dev/log
- "{{ DOCKER_DATA_ROOT }}/edxapp:/edx/var/edxapp"
roles:
- { role: docker-setup, gather_facts: no }
- common_vars
- { role: 'edxapp', skip_static_remove: True, skip_git: true, service_variants_enabled: ['cms'], migrate_db: 'no' }
- {role: demo, when: edx_install_demo is defined and edx_install_demo, tags: ['install:configuration', 'migrate']}
edxworker:
from: ubuntu:xenial #opensaas/edxapp:trusty-v3
links:
- db:db
- forums:forums
# - xqueue:xqueue
- memcache:memcache
- mongo:mongo
- es:es
- rabbitmq:rabbitmq
command: ["/edx/app/supervisor/venvs/supervisor/bin/supervisord", "-n", "--configuration", "/edx/app/supervisor/supervisord.conf"]
depends_on:
- db
- memcache
- mongo
- es
- rabbitmq
volumes:
- "{{DOCKER_EDX_ROOT}}/edx-platform:/edx/app/edxapp/edx-platform"
- /dev/log:/dev/log
roles:
- { role: docker-setup, gather_facts: no }
- common_vars
- { role: 'edxapp', celery_worker: True, skip_git: true }
analytics:
from: ubuntu:xenial #edxops/trusty-common:v3
links:
- db:db
- forums:forums
# - xqueue:xqueue
- memcache:memcache
- mongo:mongo
- es:es
- rabbitmq:rabbitmq
- insights:insights
command: ["/edx/app/supervisor/venvs/supervisor/bin/supervisord", "-n", "--configuration", "/edx/app/supervisor/supervisord.conf"]
depends_on:
- db
- memcache
- mongo
- es
- rabbitmq
volumes:
- "{{ DOCKER_EDX_ROOT }}/analytics_api:/edx/app/analytics_api"
- "{{ DOCKER_DATA_ROOT }}/analytics_api:/edx/var/analytics_api"
- /dev/log:/dev/log
roles:
- { role: docker-setup, gather_facts: no }
- common_vars
- analytics_api
edxconfig:
from: ubuntu:xenial #edxops/trusty-common:v3
links:
- db:db
- forums:forums
# - xqueue:xqueue
- memcache:memcache
- mongo:mongo
- es:es
command: /bin/false
depends_on:
- db
- memcache
- mongo
- es
- rabbitmq
roles:
- { role: docker-setup, gather_facts: no }
- common_vars
- docker_db_setup
insights:
from: ubuntu:xenial #opensaas/edx-insights
links:
- db:db
- forums:forums
# - xqueue:xqueue
- memcache:memcache
- mongo:mongo
- es:es
- rabbitmq:rabbitmq
command: ["/edx/app/supervisor/venvs/supervisor/bin/supervisord", "-n", "--configuration", "/edx/app/supervisor/supervisord.conf"]
depends_on:
- db
- memcache
- mongo
- es
- rabbitmq
volumes:
- "{{DOCKER_EDX_ROOT}}/insights:/edx/app/insights"
- /dev/log:/dev/log
- "{{ DOCKER_DATA_ROOT }}/insights:/edx/var/insights"
roles:
- { role: docker-setup, gather_facts: no }
- common_vars
- insights
analytics_pipeline:
from: ubuntu:xenial #edxops/trusty-common:v3
links:
- db:db
- forums:forums
# - xqueue:xqueue
- memcache:memcache
- mongo:mongo
- es:es
- rabbitmq:rabbitmq
- insights:insights
command: |
/bin/bash su -m hadoop -c /edx/app/hadoop/hadoop/docker-startup.sh
depends_on:
- db
- memcache
- mongo
- es
- rabbitmq
volumes:
- "{{ DOCKER_EDX_ROOT }}/hadoop:/edx/app/hadoop"
- "{{ DOCKER_DATA_ROOT }}/analytics_pipline:/edx/etc/edx-analytics-pipeline"
- "{{ DOCKER_EDX_ROOT }}/analytics_pipline:/edx/app/edx-analytics-pipeline"
- "{{ DOCKER_DATA_ROOT }}/hadoop:/edx/var/hadoop"
roles:
- { role: docker-setup, gather_facts: no }
- common_vars
- { role: 'hadoop_master', tags: ['install:app-requirements'] }
- { role: 'hive', tags: ['install:app-requirements'] }
- { role: 'sqoop', tags: ['install:app-requirements'] }
- analytics_pipeline
registries: {}
OS / ENVIRONMENT
Ansible Container, version 0.9.1
Linux, Josh-Ubuntu-PC, 4.10.0-21-generic, #23-Ubuntu SMP Fri Apr 28 16:14:22 UTC 2017, x86_64
2.7.13 (default, Jan 19 2017, 14:48:08)
[GCC 6.3.0 20170118] /usr/bin/python
{
"ContainersPaused": 0,
"Labels": null,
"CgroupDriver": "cgroupfs",
"ContainersRunning": 0,
"ContainerdCommit": {
"Expected": "9048e5e50717ea4497b757314bad98ea3763c145",
"ID": "9048e5e50717ea4497b757314bad98ea3763c145"
},
"InitBinary": "docker-init",
"NGoroutines": 23,
"Swarm": {
"ControlAvailable": false,
"NodeID": "",
"Error": "",
"RemoteManagers": null,
"LocalNodeState": "inactive",
"NodeAddr": ""
},
"LoggingDriver": "json-file",
"OSType": "linux",
"HttpProxy": "",
"Runtimes": {
"runc": {
"path": "docker-runc"
}
},
"DriverStatus": [
[
"Root Dir",
"/var/lib/docker/aufs"
],
[
"Backing Filesystem",
"extfs"
],
[
"Dirs",
"290"
],
[
"Dirperm1 Supported",
"true"
]
],
"OperatingSystem": "Ubuntu 17.04",
"Containers": 0,
"HttpsProxy": "",
"BridgeNfIp6tables": true,
"MemTotal": 8350154752,
"SecurityOptions": [
"name=apparmor",
"name=seccomp,profile=default"
],
"Driver": "aufs",
"IndexServerAddress": "https://index.docker.io/v1/",
"ClusterStore": "",
"InitCommit": {
"Expected": "949e6fa",
"ID": "949e6fa"
},
"Isolation": "",
"SystemStatus": null,
"OomKillDisable": true,
"ClusterAdvertise": "",
"SystemTime": "2017-06-07T20:15:15.241335553+10:00",
"Name": "Josh-Ubuntu-PC",
"CPUSet": true,
"RegistryConfig": {
"InsecureRegistryCIDRs": [
"127.0.0.0/8"
],
"IndexConfigs": {
"docker.io": {
"Official": true,
"Name": "docker.io",
"Secure": true,
"Mirrors": []
}
},
"Mirrors": []
},
"DefaultRuntime": "runc",
"ContainersStopped": 0,
"NCPU": 4,
"NFd": 16,
"Architecture": "x86_64",
"KernelMemory": true,
"CpuCfsQuota": true,
"Debug": false,
"ID": "O5PH:4WGS:PSZG:ZNOL:XKD7:6VLD:6OVZ:ZZ5W:TROL:EBL6:XVFB:R2IM",
"IPv4Forwarding": true,
"KernelVersion": "4.10.0-21-generic",
"BridgeNfIptables": true,
"NoProxy": "",
"LiveRestoreEnabled": false,
"ServerVersion": "17.05.0-ce",
"CpuCfsPeriod": true,
"ExperimentalBuild": false,
"MemoryLimit": true,
"SwapLimit": false,
"Plugins": {
"Volume": [
"local"
],
"Network": [
"bridge",
"host",
"macvlan",
"null",
"overlay"
],
"Authorization": []
},
"Images": 65,
"DockerRootDir": "/var/lib/docker",
"NEventsListener": 0,
"CPUShares": true,
"RuncCommit": {
"Expected": "9c2d8d184e5da67c95d601382adf14862e4f2228",
"ID": "9c2d8d184e5da67c95d601382adf14862e4f2228"
}
}
{
"KernelVersion": "4.10.0-21-generic",
"Arch": "amd64",
"BuildTime": "2017-05-04T22:10:54.638119411+00:00",
"ApiVersion": "1.29",
"Version": "17.05.0-ce",
"MinAPIVersion": "1.12",
"GitCommit": "89658be",
"Os": "linux",
"GoVersion": "go1.7.5"
}
SUMMARY
When meta/main.yml is empty or nothing is listed under dependancies ansible-container build returns AttributeError: 'NoneType' object has no attribute 'get'
when dependencies look like this
---
dependencies:
- common
ansibl-container build returns AttributeError: 'str' object has no attribute 'get'
STEPS TO REPRODUCE
make meta/main.yml blank or dependencies blanks OR
---
dependencies:
- common
EXPECTED RESULTS
Install dependencies or ignore file and continue
ACTUAL RESULTS
Failed with
Traceback (most recent call last):
File "/usr/local/bin/conductor", line 11, in <module>
load_entry_point('ansible-container', 'console_scripts', 'conductor')()
File "/_ansible/container/__init__.py", line 19, in __wrapped__
return fn(*args, **kwargs)
File "/_ansible/container/cli.py", line 360, in conductor_commandline
**params)
File "/_ansible/container/__init__.py", line 19, in __wrapped__
return fn(*args, **kwargs)
File "/_ansible/container/core.py", line 634, in conductorcmd_build
role_fingerprint = get_role_fingerprint(role)
File "/_ansible/container/__init__.py", line 19, in __wrapped__
return fn(*args, **kwargs)
File "/_ansible/container/utils/__init__.py", line 248, in get_role_fingerprint
hash_role(hash_obj, resolve_role_to_path(role_name))
File "/_ansible/container/utils/__init__.py", line 233, in hash_role
for dependency in get_dependencies_for_role(role_path):
File "/_ansible/container/utils/__init__.py", line 243, in get_dependencies_for_role
yield dependency.get('role', None)
AttributeError: 'str' object has no attribute 'get'
WORKAROUND
add role:
to each line of dependencies list like:
---
dependencies:
- { role: common }
OR put square brackets after dependencies like:
---
dependencies: []
Accepted, thank you!
@chouseknecht https://github.com/chouseknecht/ansible-container/blob/953049c/container/utils/init.py#L249
Hi, guys. Looks like a serious blocker. Any workaround suggestions?
@ilyapoz
Can you provide more detail? I'm not sure this is still an issue. It was filed against 0.9.1.
Thanks!
See summary section, perfectly describes current behavior on 0.9.2 from pip.
Never mind the workaround question actually, workaround is obviously to move dependencies to the container.yml
from meta/main.yml
Hello, our 17 roles heavily depend on meta/main.yml
in a chain, moving the dependencies to the container.yml is not a option, there any other workaround possible?
@chouseknecht I'm still getting this issue - using the same jenkins module and 0.9.3 - the workarounds don't seem to help either! It might be down to this being my first venture with ansible though!
I'm using this role, which is a version of the jenkins module which I'm trying to container enable.
https://github.com/tomasquith/ansible-role-jenkins/tree/docker
Other than that, it's straight from the ansible-container init skeleton - any help would be greatly appreciated.
Just got this issue. I added print role_path
to container/utils/__init__.py before for dependency in meta_main.get('dependencies', []):
to track down the role that's causing the issue.
If you need step by step debugging, checkout this article https://github.com/ansible/ansible-container/wiki/Using-idea-to-remote-debug-ansible-container
I managed to do it with jetbran's py debug egg.