Skip to content
This repository has been archived by the owner on Mar 23, 2019. It is now read-only.

ordereddict_to_list no attribute 'iteritems' error #533

Closed
NicoBeh opened this issue May 20, 2017 · 4 comments · Fixed by #532
Closed

ordereddict_to_list no attribute 'iteritems' error #533

NicoBeh opened this issue May 20, 2017 · 4 comments · Fixed by #532
Assignees
Labels

Comments

@NicoBeh
Copy link

NicoBeh commented May 20, 2017

ISSUE TYPE
  • Bug Report
container.yml
version: "2"

settings:
  conductor_base: ubuntu:trusty

services:
  web:
    from: "ubuntu:trusty"
    ports:
      - "1280:80"
    command: ["sleep", "120"]

registries: {}
OS / ENVIRONMENT
Ansible Container, version 0.9.1rc0
Linux, mintyserver, 4.4.0-71-generic, #92-Ubuntu SMP Fri Mar 24 12:59:01 UTC 2017, x86_64
3.5.2 (default, Nov 17 2016, 17:05:23) 
[GCC 5.4.0 20160609] /tmp/testthing/containertest/bin/python3
{
  "InitCommit": {
    "ID": "949e6fa",
    "Expected": "949e6fa"
  },
  "InitBinary": "docker-init",
  "RuncCommit": {
    "ID": "9c2d8d184e5da67c95d601382adf14862e4f2228",
    "Expected": "9c2d8d184e5da67c95d601382adf14862e4f2228"
  },
  "NFd": 46,
  "OperatingSystem": "Ubuntu 16.04.2 LTS",
  "NCPU": 4,
  "Containers": 8,
  "LiveRestoreEnabled": false,
  "NEventsListener": 0,
  "ContainersRunning": 5,
  "ClusterStore": "",
  "CPUShares": true,
  "OSType": "linux",
  "Debug": false,
  "Plugins": {
    "Network": [
      "bridge",
      "host",
      "macvlan",
      "null",
      "overlay"
    ],
    "Volume": [
      "local"
    ],
    "Authorization": []
  },
  "HttpProxy": "",
  "BridgeNfIptables": true,
  "ExperimentalBuild": false,
  "MemoryLimit": true,
  "DriverStatus": [
    [
      "Root Dir",
      "/var/lib/docker/aufs"
    ],
    [
      "Backing Filesystem",
      "extfs"
    ],
    [
      "Dirs",
      "207"
    ],
    [
      "Dirperm1 Supported",
      "true"
    ]
  ],
  "CPUSet": true,
  "HttpsProxy": "",
  "LoggingDriver": "json-file",
  "Isolation": "",
  "NoProxy": "",
  "ServerVersion": "17.05.0-ce",
  "IndexServerAddress": "https://index.docker.io/v1/",
  "RegistryConfig": {
    "InsecureRegistryCIDRs": [
      "127.0.0.0/8"
    ],
    "IndexConfigs": {
      "docker.io": {
        "Secure": true,
        "Name": "docker.io",
        "Official": true,
        "Mirrors": []
      }
    },
    "Mirrors": []
  },
  "BridgeNfIp6tables": true,
  "SystemStatus": null,
  "NGoroutines": 43,
  "Name": "mintyserver",
  "Swarm": {
    "RemoteManagers": null,
    "ControlAvailable": false,
    "Error": "",
    "NodeAddr": "",
    "LocalNodeState": "inactive",
    "NodeID": ""
  },
  "CpuCfsPeriod": true,
  "SwapLimit": false,
  "IPv4Forwarding": true,
  "KernelMemory": true,
  "Runtimes": {
    "runc": {
      "path": "docker-runc"
    }
  },
  "Labels": null,
  "SecurityOptions": [
    "name=apparmor",
    "name=seccomp,profile=default"
  ],
  "CgroupDriver": "cgroupfs",
  "CpuCfsQuota": true,
  "MemTotal": 8265940992,
  "Images": 112,
  "Driver": "aufs",
  "Architecture": "x86_64",
  "ID": "7IKT:W6V2:VBOP:BYBP:WWVN:ZGO3:42VV:T42T:6OZF:MBPE:FEFX:C7Y4",
  "SystemTime": "2017-05-20T22:48:46.299935079+02:00",
  "OomKillDisable": true,
  "ClusterAdvertise": "",
  "DockerRootDir": "/var/lib/docker",
  "ContainersPaused": 0,
  "ContainerdCommit": {
    "ID": "9048e5e50717ea4497b757314bad98ea3763c145",
    "Expected": "9048e5e50717ea4497b757314bad98ea3763c145"
  },
  "KernelVersion": "4.4.0-71-generic",
  "ContainersStopped": 3,
  "DefaultRuntime": "runc"
}
{
  "GoVersion": "go1.7.5",
  "Os": "linux",
  "BuildTime": "2017-05-04T22:10:54.638119411+00:00",
  "ApiVersion": "1.29",
  "KernelVersion": "4.4.0-71-generic",
  "Version": "17.05.0-ce",
  "GitCommit": "89658be",
  "Arch": "amd64",
  "MinAPIVersion": "1.12"
}
SUMMARY

Trying to build the shown container.yml seems to end in an AttributeError: 'dict' object has no attribute 'iteritems' error.
The following traceback seems to show that the build command tries to use the built-in iteritems() command instead of the from six import iteritems command. Since I didn't find an already open issue with this problem, it could be a local problem.

2017-05-20T22:46:36.795991 Call: Engine.run_conductor     [container.docker.engine] args=('build', {'defaults': ordereddict(), 'version': '2', 'registries': CommentedMap(), 'settings': CommentedMap([('conductor_base', 'ubuntu:trusty'), ('pwd', '/tmp/testthing/contain')]), 'services': CommentedMap([('web', CommentedMap([('from', 'ubuntu:trusty'), ('ports', ['1280:80']), ('command', ['sleep', '120'])]))])}, '/tmp/testthing/contain', {'with_variables': [], 'no_conductor_runtime': True, 'debug': True, 'roles_path': None, 'selinux': True, 'local_python': False, 'subcommand': 'build', 'flatten': False, 'ansible_options': '', 'cache': True, 'with_volumes': [], 'purge_last': True, 'save_conductor_container': False, 'devel': False}) caller_file=/tmp/testthing/ansible-container/container/docker/engine.py caller_func=Engine.run_conductor caller_line=201 kwargs={}
2017-05-20T22:46:36.799345 Unknown exception 'dict' object has no attribute 'iteritems' [container.cli] caller_file=/tmp/testthing/containertest/lib/python3.5/site-packages/structlog/stdlib.py caller_func=exception caller_line=95
Traceback (most recent call last):
  File "/tmp/testthing/ansible-container/container/cli.py", line 263, in __call__
    getattr(core, u'hostcmd_{}'.format(args.subcommand))(**vars(args))
  File "/tmp/testthing/ansible-container/container/__init__.py", line 28, in __wrapped__
    return fn(*args, **kwargs)
  File "/tmp/testthing/ansible-container/container/core.py", line 166, in hostcmd_build
    'build', dict(config), base_path, kwargs, save_container=save_container)
  File "/tmp/testthing/ansible-container/container/docker/engine.py", line 315, in await_conductor_command
    conductor_id = self.run_conductor(command, config, base_path, params)
  File "/tmp/testthing/ansible-container/container/docker/engine.py", line 82, in __wrapped__
    return fn(self, *args, **kwargs)
  File "/tmp/testthing/ansible-container/container/__init__.py", line 28, in __wrapped__
    return fn(*args, **kwargs)
  File "/tmp/testthing/ansible-container/container/docker/engine.py", line 211, in run_conductor
    serialized_config = base64.b64encode(json.dumps(ordereddict_to_list(config)).encode("utf-8")).decode()
  File "/tmp/testthing/ansible-container/container/__init__.py", line 28, in __wrapped__
    return fn(*args, **kwargs)
  File "/tmp/testthing/ansible-container/container/utils/__init__.py", line 273, in ordereddict_to_list
    for key, value in config.iteritems():
AttributeError: 'dict' object has no attribute 'iteritems'

I tried this with 2 different systems (they are both Ubuntu 16.04 though) and ended up with the same problem.

STEPS TO REPRODUCE

Run ansible-container build with the shown container.yml.

ansible-container build
EXPECTED RESULTS

A successful build of the shown container.

ACTUAL RESULTS

The said exception is raised and the build is aborted.

@chouseknecht chouseknecht self-assigned this May 22, 2017
@chouseknecht
Copy link
Contributor

chouseknecht commented May 22, 2017

@mintyLyra

OK. Looks like you're running Python 3.5 on the host. Switching from iteritems() to six.iteritems().

@NicoBeh
Copy link
Author

NicoBeh commented May 23, 2017

Yep, 5bf5dc3 did the trick

@geerlingguy
Copy link
Contributor

I ran into this as well. Looks like this was merged a couple months ago, and is just waiting on a new release? Pasting in the error I caught in a Travis CI build for the benefit of future Google Searches I know I'll be making again :D

2017-06-30T04:18:30.474713 Unknown exception 'dict' object has no attribute 'iteritems' [container.cli] caller_file=/home/travis/virtualenv/python3.5.2/lib/python3.5/site-packages/structlog/stdlib.py caller_func=exception caller_line=95

From this failed build: https://travis-ci.org/geerlingguy/ac-solr/builds/248640406#L1192

@SalahAdDin
Copy link

SalahAdDin commented Jul 8, 2017

@geerlingguy I have the same problem in python 3.6: #644

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants