saltstack / salt

Software to automate the management and configuration of any infrastructure or application at scale. Get access to the Salt software package repository here:
https://repo.saltproject.io/
Apache License 2.0
14.12k stars 5.47k forks source link

dockerng fails to decode JSON responses; believes the data are raw bytes #41996

Closed brianthelion closed 7 years ago

brianthelion commented 7 years ago

Description of Issue/Question

I am running Docker on my local machine. I am in the 'docker' group and can run the standard Docker 'hello world' from the command line. I am attempting to use dockerng to build/run an image given a Dockerfile sitting in a local directory. The Dockerfile in question is vanilla and runs just fine from the Docker CLI. I am not root, so I'm using salt-call --local state.sls <mystate> localconfig=<myconfig>. This fails with:

local:
----------
          ID: myuser/myimage:mytag
    Function: dockerng.image_present
      Result: False
     Comment: Encountered error building /home/bar/Dev/foo/build/foo.services.users as myuser/myimage:mytag: the JSON object must be str, not 'bytes'
     Started: 17:32:38.788996
    Duration: 264.832 ms
     Changes:   

Summary for local
------------
Succeeded: 0
Failed:    1
------------
Total states run:     1
Total run time: 264.832 ms

Setup

(Please provide relevant configs and/or SLS files (Be sure to remove sensitive info).)

$ which python
/home/bar/Dev/foo/env/4/bin/python
$ python
Python 3.5.3 (default, Jan 19 2017, 14:11:04) 
[GCC 6.3.0 20170118] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import docker
>>> docker.__version__
'1.10.6'
$ docker --version
Docker version 1.12.6, build 78d1802

mystate

# foo-docker/init.sls
myuser/myimage:mytag:
  dockerng.image_present:
    - build: {{ pillar['dockerfile_dir'] }}
    - force: True

myconfig

# /tmp/tmpm7k1ydjp
cachedir: /home/bar/Dev/foo/build/salt/._cache
file_roots:
  base: [/home/bar/Dev/foo/build/salt/root/states]
states_dir: /home/bar/Dev/foo/build/salt/root/states

Steps to Reproduce Issue

(Include debug logs if possible and relevant.)

/home/bar/Dev/foo/env/4/bin/salt-call --local \
   -l all \
   state.sls foo-docker \
   localconfig=/tmp/tmpm7k1ydjp \
   pillar="{'dockerfile_dir': '/home/bar/Dev/foo/build/foo.services.users'}"
[DEBUG   ] Reading configuration from /etc/salt/minion
[DEBUG   ] Including configuration from '/etc/salt/minion.d/_schedule.conf'
[DEBUG   ] Reading configuration from /etc/salt/minion.d/_schedule.conf
[DEBUG   ] Using cached minion ID from /etc/salt/minion_id: dathon
[TRACE   ] The required configuration section, 'fluent_handler', was not found the in the configuration. Not loading the fluent logging handlers module.
[TRACE   ] None of the required configuration sections, 'logstash_udp_handler' and 'logstash_zmq_handler', were found in the configuration. Not loading the Logstash logging handlers module.
[DEBUG   ] Configuration file path: /etc/salt/minion
[WARNING ] Failed to open log file, do you have permission to write to /var/log/salt/minion?
[WARNING ] Insecure logging configuration detected! Sensitive data may be logged.
[DEBUG   ] Reading configuration from /etc/salt/minion
[DEBUG   ] Including configuration from '/etc/salt/minion.d/_schedule.conf'
[DEBUG   ] Reading configuration from /etc/salt/minion.d/_schedule.conf
[TRACE   ] Loading core.hostname grain
[TRACE   ] Loading core.zmqversion grain
[TRACE   ] Loading core.id_ grain
[TRACE   ] Loading core.saltversion grain
[TRACE   ] Loading core.pythonpath grain
[TRACE   ] Loading core.saltversioninfo grain
[TRACE   ] Loading core.get_machine_id grain
[TRACE   ] Loading core.locale_info grain
[TRACE   ] Loading core.hwaddr_interfaces grain
[TRACE   ] Loading core.ip4_interfaces grain
[TRACE   ] Loading core.os_data grain
[TRACE   ] DMI system-uuid value /sys/firmware/dmi/tables/smbios_entry_point: Permission denied /dev/mem: Permission denied is an invalid UUID
[TRACE   ] DMI system-uuid value /sys/firmware/dmi/tables/smbios_entry_point: Permission denied /dev/mem: Permission denied is an invalid UUID
[TRACE   ] 'virt-what' could not be found in the following search path: '['/usr/local/sbin', '/usr/local/bin', '/usr/sbin', '/usr/bin', '/sbin', '/bin', '/usr/games', '/usr/local/games', '/snap/bin']'
[DEBUG   ] Please install 'virt-what' to improve results of the 'virtual' grain.
[TRACE   ] 'virt-what' could not be found in the following search path: '['/usr/local/sbin', '/usr/local/bin', '/usr/sbin', '/usr/bin', '/sbin', '/bin', '/usr/games', '/usr/local/games', '/snap/bin']'
[WARNING ] Although 'dmidecode' was found in path, the current user cannot execute it. Grains output might not be accurate.
[TRACE   ] Loading core.pythonexecutable grain
[TRACE   ] Loading core.ip6_interfaces grain
[TRACE   ] Loading core.path grain
[TRACE   ] Loading core.dns grain
[TRACE   ] Loading core.get_master grain
[TRACE   ] Loading core.ip_interfaces grain
[TRACE   ] Loading core.saltpath grain
[TRACE   ] Loading core.ip_fqdn grain
[TRACE   ] Loading core.pythonversion grain
[TRACE   ] Loading core.get_server_id grain
[TRACE   ] Loading core.append_domain grain
[TRACE   ] Device loop1 reports itself as an HDD
[TRACE   ] Device loop6 reports itself as an HDD
[TRACE   ] Device loop4 reports itself as an HDD
[TRACE   ] Device loop2 reports itself as an HDD
[TRACE   ] Device loop0 reports itself as an HDD
[TRACE   ] Device sda reports itself as an HDD
[TRACE   ] Device loop7 reports itself as an HDD
[TRACE   ] Device nvme0n1 reports itself as an SSD
[TRACE   ] Device loop5 reports itself as an HDD
[TRACE   ] Device loop3 reports itself as an HDD
[DEBUG   ] Determining pillar cache
[DEBUG   ] LazyLoaded jinja.render
[DEBUG   ] LazyLoaded yaml.render
[DEBUG   ] LazyLoaded jinja.render
[DEBUG   ] LazyLoaded yaml.render
[DEBUG   ] LazyLoaded state.sls
Cannot write to process directory. Do you have permissions to write to /var/cache/salt/minion/proc/20170628180527599456 ?
[DEBUG   ] LazyLoaded saltutil.is_running
[DEBUG   ] LazyLoaded grains.get
[DEBUG   ] Reading configuration from /tmp/tmpm7k1ydjp
[DEBUG   ] LazyLoaded roots.envs
[DEBUG   ] Could not LazyLoad roots.init: 'roots.init' is not available.
[DEBUG   ] Updating roots fileserver cache
[TRACE   ] Lockfile /home/bar/Dev/foo/build/salt/._cache/file_lists/roots/.base.w created
[TRACE   ] roots: Processing /home/bar/Dev/foo/build/salt/root/states/foo-docker
[TRACE   ] roots: /home/bar/Dev/foo/build/salt/root/states/foo-docker is not a link
[TRACE   ] roots: /home/bar/Dev/foo/build/salt/root/states/foo-docker relative path is foo-docker
[TRACE   ] roots: Processing /home/bar/Dev/foo/build/salt/root/states/foo
[TRACE   ] roots: /home/bar/Dev/foo/build/salt/root/states/foo is not a link
[TRACE   ] roots: /home/bar/Dev/foo/build/salt/root/states/foo relative path is foo
[TRACE   ] roots: Processing /home/bar/Dev/foo/build/salt/root/states/pyramid
[TRACE   ] roots: /home/bar/Dev/foo/build/salt/root/states/pyramid is not a link
[TRACE   ] roots: /home/bar/Dev/foo/build/salt/root/states/pyramid relative path is pyramid
[TRACE   ] roots: Processing /home/bar/Dev/foo/build/salt/root/states/top.sls
[TRACE   ] roots: /home/bar/Dev/foo/build/salt/root/states/top.sls is not a link
[TRACE   ] roots: /home/bar/Dev/foo/build/salt/root/states/top.sls relative path is top.sls
[TRACE   ] roots: Processing /home/bar/Dev/foo/build/salt/root/states/foo.sls
[TRACE   ] roots: /home/bar/Dev/foo/build/salt/root/states/foo.sls is not a link
[TRACE   ] roots: /home/bar/Dev/foo/build/salt/root/states/foo.sls relative path is foo.sls
[TRACE   ] roots: Processing /home/bar/Dev/foo/build/salt/root/states/foo-docker/build_template.sls
[TRACE   ] roots: /home/bar/Dev/foo/build/salt/root/states/foo-docker/build_template.sls is not a link
[TRACE   ] roots: /home/bar/Dev/foo/build/salt/root/states/foo-docker/build_template.sls relative path is foo-docker/build_template.sls
[TRACE   ] roots: Processing /home/bar/Dev/foo/build/salt/root/states/foo-docker/global_vars.jinja
[TRACE   ] roots: /home/bar/Dev/foo/build/salt/root/states/foo-docker/global_vars.jinja is not a link
[TRACE   ] roots: /home/bar/Dev/foo/build/salt/root/states/foo-docker/global_vars.jinja relative path is foo-docker/global_vars.jinja
[TRACE   ] roots: Processing /home/bar/Dev/foo/build/salt/root/states/foo-docker/build_template2.sls
[TRACE   ] roots: /home/bar/Dev/foo/build/salt/root/states/foo-docker/build_template2.sls is not a link
[TRACE   ] roots: /home/bar/Dev/foo/build/salt/root/states/foo-docker/build_template2.sls relative path is foo-docker/build_template2.sls
[TRACE   ] roots: Processing /home/bar/Dev/foo/build/salt/root/states/foo-docker/init.sls
[TRACE   ] roots: /home/bar/Dev/foo/build/salt/root/states/foo-docker/init.sls is not a link
[TRACE   ] roots: /home/bar/Dev/foo/build/salt/root/states/foo-docker/init.sls relative path is foo-docker/init.sls
[TRACE   ] roots: Processing /home/bar/Dev/foo/build/salt/root/states/foo-docker/init.bak
[TRACE   ] roots: /home/bar/Dev/foo/build/salt/root/states/foo-docker/init.bak is not a link
[TRACE   ] roots: /home/bar/Dev/foo/build/salt/root/states/foo-docker/init.bak relative path is foo-docker/init.bak
[TRACE   ] roots: Processing /home/bar/Dev/foo/build/salt/root/states/foo/init.sls
[TRACE   ] roots: /home/bar/Dev/foo/build/salt/root/states/foo/init.sls is not a link
[TRACE   ] roots: /home/bar/Dev/foo/build/salt/root/states/foo/init.sls relative path is foo/init.sls
[TRACE   ] roots: Processing /home/bar/Dev/foo/build/salt/root/states/pyramid/init.sls
[TRACE   ] roots: /home/bar/Dev/foo/build/salt/root/states/pyramid/init.sls is not a link
[TRACE   ] roots: /home/bar/Dev/foo/build/salt/root/states/pyramid/init.sls relative path is pyramid/init.sls
[TRACE   ] Lockfile /home/bar/Dev/foo/build/salt/._cache/file_lists/roots/.base.w removed
[DEBUG   ] Determining pillar cache
[DEBUG   ] LazyLoaded jinja.render
[DEBUG   ] LazyLoaded yaml.render
[INFO    ] Loading fresh modules for state activity
[DEBUG   ] LazyLoaded jinja.render
[DEBUG   ] LazyLoaded yaml.render
[DEBUG   ] Could not find file 'salt://foo-docker.sls' in saltenv 'base'
[DEBUG   ] In saltenv 'base', looking at rel_path 'foo-docker/init.sls' to resolve 'salt://foo-docker/init.sls'
[DEBUG   ] In saltenv 'base', ** considering ** path '/home/bar/Dev/foo/build/salt/._cache/files/base/foo-docker/init.sls' to resolve 'salt://foo-docker/init.sls'
[DEBUG   ] compile template: /home/bar/Dev/foo/build/salt/._cache/files/base/foo-docker/init.sls
[DEBUG   ] Jinja search path: ['/home/bar/Dev/foo/build/salt/._cache/files/base']
[PROFILE ] Time (in seconds) to render '/home/bar/Dev/foo/build/salt/._cache/files/base/foo-docker/init.sls' using 'jinja' renderer: 0.012637138366699219
[DEBUG   ] Rendered data from file: /home/bar/Dev/foo/build/salt/._cache/files/base/foo-docker/init.sls:
myuser/myimage:mytag:
  dockerng.image_present:
    - build: /home/bar/Dev/foo/build/foo.services.users
    - force: True

[DEBUG   ] LazyLoaded config.get
[DEBUG   ] Results of YAML rendering: 
OrderedDict([('myuser/myimage:mytag', OrderedDict([('dockerng.image_present', [OrderedDict([('build', '/home/bar/Dev/foo/build/foo.services.users')]), OrderedDict([('force', True)])])]))])
[PROFILE ] Time (in seconds) to render '/home/bar/Dev/foo/build/salt/._cache/files/base/foo-docker/init.sls' using 'yaml' renderer: 0.019393205642700195
[DEBUG   ] Trying paths: <filter object at 0x7f5c30f259e8>
[DEBUG   ] No config file found
[DEBUG   ] http://localhost:None "GET /version HTTP/1.1" 200 206
[DEBUG   ] Attempting to run docker-py's "version" function with args=() and kwargs={}
[DEBUG   ] http://localhost:None "GET /v1.24/version HTTP/1.1" 200 206
[DEBUG   ] LazyLoaded dockerng.version
[DEBUG   ] LazyLoaded dockerng.image_present
[INFO    ] Running state [myuser/myimage:mytag] at time 18:05:27.850271
[INFO    ] Executing state dockerng.image_present for myuser/myimage:mytag
[DEBUG   ] Attempting to run docker-py's "images" function with args=() and kwargs={'all': False}
[DEBUG   ] http://localhost:None "GET /v1.24/images/json?only_ids=0&all=0 HTTP/1.1" 200 None
[DEBUG   ] Attempting to run docker-py's "build" function with args=() and kwargs={'quiet': False, 'nocache': False, 'rm': True, 'fileobj': None, 'tag': 'myuser/myimage:mytag', 'path': '/home/bar/Dev/foo/build/foo.services.users', 'dockerfile': None}
[DEBUG   ] Looking for auth config
[DEBUG   ] No auth config in memory - loading from filesystem
[DEBUG   ] Trying paths: <filter object at 0x7f5c30eee908>
[DEBUG   ] No config file found
[DEBUG   ] No auth config found
[DEBUG   ] http://localhost:None "POST /v1.24/build?nocache=False&pull=False&forcerm=False&q=False&t=myuser%2Fmyimage%3Amytag&rm=True HTTP/1.1" 200 None
[ERROR   ] Encountered error building /home/bar/Dev/foo/build/foo.services.users as myuser/myimage:mytag: the JSON object must be str, not 'bytes'
[INFO    ] Completed state [myuser/myimage:mytag] at time 18:05:28.097152 duration_in_ms=246.88
[DEBUG   ] File /home/bar/Dev/foo/build/salt/._cache/accumulator/140033937206912 does not exist, no need to cleanup.
[DEBUG   ] LazyLoaded config.option
[ERROR   ] Unable to write to SLS cache file /var/cache/salt/minion/sls.p. Check permission.
[ERROR   ] Unable to write to highstate cache file /var/cache/salt/minion/highstate.cache.p. Do you have permissions?
[DEBUG   ] LazyLoaded highstate.output
[TRACE   ] data = {'local': {'dockerng_|-myuser/myimage:mytag_|-myuser/myimage:mytag_|-image_present': {'name': 'myuser/myimage:mytag', 'changes': {}, 'comment': "Encountered error building /home/bar/Dev/foo/build/foo.services.users as myuser/myimage:mytag: the JSON object must be str, not 'bytes'", 'start_time': '18:05:27.850272', 'duration': '246.88 ms', 'result': False, '__id__': 'myuser/myimage:mytag', '__run_num__': 0}}}
local:
----------
          ID: myuser/myimage:mytag
    Function: dockerng.image_present
      Result: False
     Comment: Encountered error building /home/bar/Dev/foo/build/foo.services.users as myuser/myimage:mytag: the JSON object must be str, not 'bytes'
     Started: 18:05:27.850272
    Duration: 246.88 ms
     Changes:   

Summary for local
------------
Succeeded: 0
Failed:    1
------------
Total states run:     1
Total run time: 246.880 ms

Versions Report

(Provided by running salt --versions-report. Please also mention any differences in master/minion versions.)

# /home/bar/Dev/foo/env/4/bin/salt --versions-report
Salt Version:
           Salt: 2016.11.6

Dependency Versions:
           cffi: Not Installed
       cherrypy: Not Installed
       dateutil: Not Installed
      docker-py: 1.10.6
          gitdb: Not Installed
      gitpython: Not Installed
          ioflo: Not Installed
         Jinja2: 2.9.6
        libgit2: Not Installed
        libnacl: Not Installed
       M2Crypto: Not Installed
           Mako: Not Installed
   msgpack-pure: Not Installed
 msgpack-python: 0.4.8
   mysql-python: Not Installed
      pycparser: Not Installed
       pycrypto: 2.6.1
   pycryptodome: Not Installed
         pygit2: Not Installed
         Python: 3.5.3 (default, Jan 19 2017, 14:11:04)
   python-gnupg: Not Installed
         PyYAML: 3.12
          PyZMQ: 16.0.2
           RAET: Not Installed
          smmap: Not Installed
        timelib: Not Installed
        Tornado: 4.5.1
            ZMQ: 4.1.6

System Versions:
           dist: Ubuntu 17.04 zesty
        machine: x86_64
        release: 4.12.0-041200rc6-generic
         system: Linux
        version: Ubuntu 17.04 zesty
brianthelion commented 7 years ago

The bug is not likely in docker-py since this

[DEBUG   ] Attempting to run docker-py's "build" function with args=() and kwargs={'quiet': False, 'nocache': False, 'rm': True, 'fileobj': None, 'tag': 'myuser/myimage:mytag', 'path': '/home/bar/Dev/foo/build/foo.services.users', 'dockerfile': None}

presumably translates to this

>> from docker import Client
>>> client = Client("unix:///var/run/docker.sock")
>>> it = client.build(path="/home/bar/Dev/foo/build/foo.services.users")
>>> for line in it: print(line)
... 

which runs fine

b'{"stream":"Step 1 : FROM ubuntu:16.04\\n"}\r\n'
b'{"stream":" ---\\u003e d355ed3537e9\\n"}\r\n'
b'{"stream":"Step 2 : RUN apt-get update -y \\u0026\\u0026     apt-get install -y python3-pip python3-dev git libssl-dev \\u0026\\u0026     pip3 install --upgrade pip setuptools\\n"}\r\n'
b'{"stream":" ---\\u003e Using cache\\n"}\r\n'
b'{"stream":" ---\\u003e fcab9c016144\\n"}\r\n'
b'{"stream":"Step 3 : COPY ./requirements.txt /app/requirements.txt\\n"}\r\n'
b'{"stream":" ---\\u003e Using cache\\n"}\r\n'
b'{"stream":" ---\\u003e cedeffd1d54e\\n"}\r\n'
b'{"stream":"Step 4 : WORKDIR /app\\n"}\r\n'
b'{"stream":" ---\\u003e Using cache\\n"}\r\n'
b'{"stream":" ---\\u003e 0069831017c1\\n"}\r\n'
b'{"stream":"Step 5 : RUN pip install -r requirements.txt\\n"}\r\n'
b'{"stream":" ---\\u003e Using cache\\n"}\r\n'
b'{"stream":" ---\\u003e 216da2304e23\\n"}\r\n'
b'{"stream":"Step 6 : COPY . /app\\n"}\r\n'
b'{"stream":" ---\\u003e Using cache\\n"}\r\n'
b'{"stream":" ---\\u003e 70b524b0d6e3\\n"}\r\n'
b'{"stream":"Step 7 : RUN git init\\n"}\r\n'
b'{"stream":" ---\\u003e Using cache\\n"}\r\n'
b'{"stream":" ---\\u003e 78396a3e4dd6\\n"}\r\n'
b'{"stream":"Step 8 : RUN pip3 install .\\n"}\r\n'
b'{"stream":" ---\\u003e Using cache\\n"}\r\n'
b'{"stream":" ---\\u003e eecc4a06806b\\n"}\r\n'
b'{"stream":"Step 9 : RUN mkdir db_data\\n"}\r\n'
b'{"stream":" ---\\u003e Using cache\\n"}\r\n'
b'{"stream":" ---\\u003e d8129b0f7f8e\\n"}\r\n'
b'{"stream":"Step 10 : RUN initialize_sample_db production.ini\\n"}\r\n'
b'{"stream":" ---\\u003e Using cache\\n"}\r\n'
b'{"stream":" ---\\u003e 3c7a1165cd48\\n"}\r\n'
b'{"stream":"Step 11 : ENTRYPOINT pserve\\n"}\r\n'
b'{"stream":" ---\\u003e Using cache\\n"}\r\n'
b'{"stream":" ---\\u003e b4c42b6540fc\\n"}\r\n'
b'{"stream":"Step 12 : CMD production.ini\\n"}\r\n'
b'{"stream":" ---\\u003e Using cache\\n"}\r\n'
b'{"stream":" ---\\u003e dc0966947e9c\\n"}\r\n'
b'{"stream":"Successfully built dc0966947e9c\\n"}\r\n'

but is indeed raw bytes.

gtmanfred commented 7 years ago

Yup, we need to get this fixed.

@terminalmage you will be interested in this.

Thanks, Daniel

gtmanfred commented 7 years ago

@brianthelion actually, dockerng is the module on 2016.11, which does not gaurantee support for python3.

We will be supporting python3 on 2017.7 which we are working on a release candidate for now, can you try the docker module on 2017.7?

Thanks, Daniel

terminalmage commented 7 years ago

You should be able to use the same SLS in 2017.7, it's backward-compatible. You will however be warned that the correct state name is now docker_image.present instead of dockerng.image_present.

brianthelion commented 7 years ago

Thanks for the attention, all. Sorry to be a bother -- Salt noob here -- but is the best way to test the 2017.7 release candidate to git clone and install from source? Cheers! ~br

terminalmage commented 7 years ago

@brianthelion you mentioned that you have installed Salt into a virtualenv. In this case, I recommend something like the following (assuming you are activated into your virtualenv):

pip uninstall salt
git clone https://github.com/saltstack/salt /path/to/clone
cd /path/to/clone
git checkout -b 2017.7 origin/2017.7
pip install -e /path/to/clone

This will install Salt from the git checkout into the virtualenv. You can also use this for future testing, however I would recommend doing a find /path/to/clone -type -f -name \*.pyc -delete to remove the byte-compiled files whenever you change the current branch for the clone.

I would also recommend setting root_dir: /path/to/virtualenv in both your master and minion config file, as it will keep the cache and everything within the virtualenv. However, you don't really need to do this.

brianthelion commented 7 years ago

@terminalmage Before I saw your message I went ahead and cloned and then pip installed master/HEAD to a fresh pyvenv-3.5. It looks as if there's a new bug in which my pillar= gets ignored.

$ /home/bar/Dev/foo/env/5/bin/salt-call --local -l all state.sls foo-docker localconfig=/tmp/tmpm7k1ydjp pillar="{'package_dir': '/home/bar/Dev/foo/build/foo.services.users'}"
[DEBUG   ] Reading configuration from /etc/salt/minion
[DEBUG   ] Including configuration from '/etc/salt/minion.d/_schedule.conf'
[DEBUG   ] Reading configuration from /etc/salt/minion.d/_schedule.conf
[DEBUG   ] Using cached minion ID from /etc/salt/minion_id: dathon
[TRACE   ] The required configuration section, 'fluent_handler', was not found the in the configuration. Not loading the fluent logging handlers module.
[TRACE   ] None of the required configuration sections, 'logstash_udp_handler' and 'logstash_zmq_handler', were found in the configuration. Not loading the Logstash logging handlers module.
[DEBUG   ] Configuration file path: /etc/salt/minion
[WARNING ] Failed to open log file, do you have permission to write to /var/log/salt/minion?
[WARNING ] Insecure logging configuration detected! Sensitive data may be logged.
[DEBUG   ] Grains refresh requested. Refreshing grains.
[DEBUG   ] Reading configuration from /etc/salt/minion
[DEBUG   ] Including configuration from '/etc/salt/minion.d/_schedule.conf'
[DEBUG   ] Reading configuration from /etc/salt/minion.d/_schedule.conf
[TRACE   ] 'esxcli' could not be found in the following search path: '['/home/bar/Dev/foo/env/salty/bin', '/usr/local/sbin', '/usr/local/bin', '/usr/sbin', '/usr/bin', '/sbin', '/bin', '/usr/games', '/usr/local/games', '/snap/bin']'
[TRACE   ] Depends decorator instantiated with dep list of (False,)
[TRACE   ] Depends decorator instantiated with dep list of (False,)
[TRACE   ] Depends decorator instantiated with dep list of (False,)
[TRACE   ] Depends decorator instantiated with dep list of (False,)
[TRACE   ] Depends decorator instantiated with dep list of (False,)
[TRACE   ] Depends decorator instantiated with dep list of (False,)
[TRACE   ] Depends decorator instantiated with dep list of (False,)
[TRACE   ] Depends decorator instantiated with dep list of (False,)
[TRACE   ] Depends decorator instantiated with dep list of (False,)
[TRACE   ] Depends decorator instantiated with dep list of (False,)
[TRACE   ] Depends decorator instantiated with dep list of (False,)
[TRACE   ] Depends decorator instantiated with dep list of (False,)
[TRACE   ] Depends decorator instantiated with dep list of (False,)
[TRACE   ] Depends decorator instantiated with dep list of (False,)
[TRACE   ] Depends decorator instantiated with dep list of (False,)
[TRACE   ] Depends decorator instantiated with dep list of (False,)
[TRACE   ] Depends decorator instantiated with dep list of (False,)
[TRACE   ] Depends decorator instantiated with dep list of (False,)
[TRACE   ] Depends decorator instantiated with dep list of (False,)
[TRACE   ] Depends decorator instantiated with dep list of (False,)
[TRACE   ] Depends decorator instantiated with dep list of (False,)
[TRACE   ] Depends decorator instantiated with dep list of (False,)
[TRACE   ] Depends decorator instantiated with dep list of (False,)
[TRACE   ] Depends decorator instantiated with dep list of (False,)
[TRACE   ] Depends decorator instantiated with dep list of (False,)
[TRACE   ] Depends decorator instantiated with dep list of (False,)
[TRACE   ] Depends decorator instantiated with dep list of (False,)
[TRACE   ] Depends decorator instantiated with dep list of (False,)
[TRACE   ] Depends decorator instantiated with dep list of (False,)
[TRACE   ] Depends decorator instantiated with dep list of (False,)
[TRACE   ] Depends decorator instantiated with dep list of (False,)
[TRACE   ] Depends decorator instantiated with dep list of (False,)
[TRACE   ] Depends decorator instantiated with dep list of (False,)
[TRACE   ] Depends decorator instantiated with dep list of (False,)
[TRACE   ] Depends decorator instantiated with dep list of (False,)
[TRACE   ] Depends decorator instantiated with dep list of (False,)
[TRACE   ] Depends decorator instantiated with dep list of (False,)
[TRACE   ] Depends decorator instantiated with dep list of (False,)
[TRACE   ] Depends decorator instantiated with dep list of (False,)
[TRACE   ] Depends decorator instantiated with dep list of (False,)
[TRACE   ] Depends decorator instantiated with dep list of (False,)
[TRACE   ] Depends decorator instantiated with dep list of (False,)
[TRACE   ] Depends decorator instantiated with dep list of (False,)
[TRACE   ] Depends decorator instantiated with dep list of (False,)
[TRACE   ] Error loading grains.napalm: "napalm"" (/home/bar/Dev/foo/build/saltstack/salt/grains/napalm.py) cannot be loaded: NAPALM is not installed or not running in a (proxy) minion
[TRACE   ] Loading core.append_domain grain
[TRACE   ] Loading core.dns grain
[TRACE   ] Loading core.get_machine_id grain
[TRACE   ] Loading core.get_master grain
[TRACE   ] Loading core.get_server_id grain
[TRACE   ] Loading core.hostname grain
[TRACE   ] Loading core.hwaddr_interfaces grain
[TRACE   ] Loading core.id_ grain
[TRACE   ] Loading core.ip4_interfaces grain
[TRACE   ] Loading core.ip6_interfaces grain
[TRACE   ] Loading core.ip_fqdn grain
[TRACE   ] Loading core.ip_interfaces grain
[TRACE   ] Loading core.linux_distribution grain
[TRACE   ] Loading core.locale_info grain
[TRACE   ] Loading core.os_data grain
[TRACE   ] 'zpool' could not be found in the following search path: '['/home/bar/Dev/foo/env/salty/bin', '/usr/local/sbin', '/usr/local/bin', '/usr/sbin', '/usr/bin', '/sbin', '/bin', '/usr/games', '/usr/local/games', '/snap/bin']'
[TRACE   ] 'virt-what' could not be found in the following search path: '['/home/bar/Dev/foo/env/salty/bin', '/usr/local/sbin', '/usr/local/bin', '/usr/sbin', '/usr/bin', '/sbin', '/bin', '/usr/games', '/usr/local/games', '/snap/bin']'
[DEBUG   ] Please install 'virt-what' to improve results of the 'virtual' grain.
[TRACE   ] 'virt-what' could not be found in the following search path: '['/home/bar/Dev/foo/env/salty/bin', '/usr/local/sbin', '/usr/local/bin', '/usr/sbin', '/usr/bin', '/sbin', '/bin', '/usr/games', '/usr/local/games', '/snap/bin']'
[INFO    ] Although 'dmidecode' was found in path, the current user cannot execute it. Grains output might not be accurate.
[TRACE   ] Loading core.path grain
[TRACE   ] Loading core.pythonexecutable grain
[TRACE   ] Loading core.pythonpath grain
[TRACE   ] Loading core.pythonversion grain
[TRACE   ] Loading core.saltpath grain
[TRACE   ] Loading core.saltversion grain
[TRACE   ] Loading core.saltversioninfo grain
[TRACE   ] Loading core.zmqversion grain
[TRACE   ] Loading disks.disks grain
[TRACE   ] Device loop1 reports itself as an HDD
[TRACE   ] Device loop6 reports itself as an HDD
[TRACE   ] Device loop4 reports itself as an HDD
[TRACE   ] Device loop2 reports itself as an HDD
[TRACE   ] Device loop0 reports itself as an HDD
[TRACE   ] Device sda reports itself as an HDD
[TRACE   ] Device loop7 reports itself as an HDD
[TRACE   ] Device nvme0n1 reports itself as an SSD
[TRACE   ] Device loop5 reports itself as an HDD
[TRACE   ] Device loop3 reports itself as an HDD
[TRACE   ] Loading extra.config grain
[TRACE   ] Loading extra.shell grain
[TRACE   ] Loading mdadm.mdadm grain
[TRACE   ] Loading minion_process.grains grain
[TRACE   ] Loading opts.opts grain
[DEBUG   ] Determining pillar cache
[DEBUG   ] LazyLoaded jinja.render
[DEBUG   ] LazyLoaded yaml.render
[DEBUG   ] LazyLoaded jinja.render
[DEBUG   ] LazyLoaded yaml.render
[DEBUG   ] LazyLoaded state.sls
Cannot write to process directory. Do you have permissions to write to /var/cache/salt/minion/proc/20170629123200543774 ?
[DEBUG   ] LazyLoaded saltutil.is_running
[DEBUG   ] LazyLoaded grains.get
[DEBUG   ] Reading configuration from /tmp/tmpm7k1ydjp
[DEBUG   ] LazyLoaded roots.envs
[DEBUG   ] Could not LazyLoad roots.init: 'roots.init' is not available.
[DEBUG   ] Updating roots fileserver cache
[TRACE   ] Lockfile /home/bar/Dev/foo/build/salt/._cache/file_lists/roots/.base.w created
[TRACE   ] roots: Processing /home/bar/Dev/foo/build/salt/root/states/foo-docker
[TRACE   ] roots: /home/bar/Dev/foo/build/salt/root/states/foo-docker is not a link
[TRACE   ] roots: /home/bar/Dev/foo/build/salt/root/states/foo-docker relative path is foo-docker
[TRACE   ] roots: Processing /home/bar/Dev/foo/build/salt/root/states/foo
[TRACE   ] roots: /home/bar/Dev/foo/build/salt/root/states/foo is not a link
[TRACE   ] roots: /home/bar/Dev/foo/build/salt/root/states/foo relative path is foo
[TRACE   ] roots: Processing /home/bar/Dev/foo/build/salt/root/states/pyramid
[TRACE   ] roots: /home/bar/Dev/foo/build/salt/root/states/pyramid is not a link
[TRACE   ] roots: /home/bar/Dev/foo/build/salt/root/states/pyramid relative path is pyramid
[TRACE   ] roots: Processing /home/bar/Dev/foo/build/salt/root/states/top.sls
[TRACE   ] roots: /home/bar/Dev/foo/build/salt/root/states/top.sls is not a link
[TRACE   ] roots: /home/bar/Dev/foo/build/salt/root/states/top.sls relative path is top.sls
[TRACE   ] roots: Processing /home/bar/Dev/foo/build/salt/root/states/foo.sls
[TRACE   ] roots: /home/bar/Dev/foo/build/salt/root/states/foo.sls is not a link
[TRACE   ] roots: /home/bar/Dev/foo/build/salt/root/states/foo.sls relative path is foo.sls
[TRACE   ] roots: Processing /home/bar/Dev/foo/build/salt/root/states/foo-docker/build_template.sls
[TRACE   ] roots: /home/bar/Dev/foo/build/salt/root/states/foo-docker/build_template.sls is not a link
[TRACE   ] roots: /home/bar/Dev/foo/build/salt/root/states/foo-docker/build_template.sls relative path is foo-docker/build_template.sls
[TRACE   ] roots: Processing /home/bar/Dev/foo/build/salt/root/states/foo-docker/global_vars.jinja
[TRACE   ] roots: /home/bar/Dev/foo/build/salt/root/states/foo-docker/global_vars.jinja is not a link
[TRACE   ] roots: /home/bar/Dev/foo/build/salt/root/states/foo-docker/global_vars.jinja relative path is foo-docker/global_vars.jinja
[TRACE   ] roots: Processing /home/bar/Dev/foo/build/salt/root/states/foo-docker/build_template2.sls
[TRACE   ] roots: /home/bar/Dev/foo/build/salt/root/states/foo-docker/build_template2.sls is not a link
[TRACE   ] roots: /home/bar/Dev/foo/build/salt/root/states/foo-docker/build_template2.sls relative path is foo-docker/build_template2.sls
[TRACE   ] roots: Processing /home/bar/Dev/foo/build/salt/root/states/foo-docker/init.sls
[TRACE   ] roots: /home/bar/Dev/foo/build/salt/root/states/foo-docker/init.sls is not a link
[TRACE   ] roots: /home/bar/Dev/foo/build/salt/root/states/foo-docker/init.sls relative path is foo-docker/init.sls
[TRACE   ] roots: Processing /home/bar/Dev/foo/build/salt/root/states/foo-docker/init.bak
[TRACE   ] roots: /home/bar/Dev/foo/build/salt/root/states/foo-docker/init.bak is not a link
[TRACE   ] roots: /home/bar/Dev/foo/build/salt/root/states/foo-docker/init.bak relative path is foo-docker/init.bak
[TRACE   ] roots: Processing /home/bar/Dev/foo/build/salt/root/states/foo/init.sls
[TRACE   ] roots: /home/bar/Dev/foo/build/salt/root/states/foo/init.sls is not a link
[TRACE   ] roots: /home/bar/Dev/foo/build/salt/root/states/foo/init.sls relative path is foo/init.sls
[TRACE   ] roots: Processing /home/bar/Dev/foo/build/salt/root/states/pyramid/init.sls
[TRACE   ] roots: /home/bar/Dev/foo/build/salt/root/states/pyramid/init.sls is not a link
[TRACE   ] roots: /home/bar/Dev/foo/build/salt/root/states/pyramid/init.sls relative path is pyramid/init.sls
[TRACE   ] Lockfile /home/bar/Dev/foo/build/salt/._cache/file_lists/roots/.base.w removed
[INFO    ] Loading fresh modules for state activity
[DEBUG   ] LazyLoaded jinja.render
[DEBUG   ] LazyLoaded yaml.render
[DEBUG   ] Could not find file 'salt://foo-docker.sls' in saltenv 'base'
[DEBUG   ] In saltenv 'base', looking at rel_path 'foo-docker/init.sls' to resolve 'salt://foo-docker/init.sls'
[DEBUG   ] In saltenv 'base', ** considering ** path '/home/bar/Dev/foo/build/salt/._cache/files/base/foo-docker/init.sls' to resolve 'salt://foo-docker/init.sls'
[DEBUG   ] compile template: /home/bar/Dev/foo/build/salt/._cache/files/base/foo-docker/init.sls
[DEBUG   ] Jinja search path: ['/home/bar/Dev/foo/build/salt/._cache/files/base']
[ERROR   ] Rendering exception occurred: Jinja variable 'salt.pillar object' has no attribute 'package_dir'
[CRITICAL] Rendering SLS 'base:foo-docker' failed: Jinja variable 'salt.pillar object' has no attribute 'package_dir'
[DEBUG   ] LazyLoaded highstate.output
[TRACE   ] data = {'local': ["Rendering SLS 'base:foo-docker' failed: Jinja variable 'salt.pillar object' has no attribute 'package_dir'"]}

Is pillar access changed in the new version?

terminalmage commented 7 years ago

Can I see the SLS you're using now? Your original example set a pillar variable called dockerfile_dir, but the error message refers to package_dir.

terminalmage commented 7 years ago

Oh, nevermind, I see that you changed it in the command at the beginning of your example. I'd still like to see your SLS though, an AttributeError doesn't make sense here.

brianthelion commented 7 years ago

@terminalmage I updated the pillar access from pillar['package_dir'] to salt['pillar.get']('package_dir') and everything ran down to the dockerng calls. Updating that now.

brianthelion commented 7 years ago

Updated dockerng.image_present to docker.image_present and got:

local:
----------
          ID: myuser/myimage:mytag
    Function: docker.image_present
      Result: False
     Comment: State 'docker.image_present' was not found in SLS 'foo-docker'
              Reason: 'docker' __virtual__ returned False: 'docker.version' is not available.
     Changes:   

Summary for local
------------
Succeeded: 0
Failed:    1
------------
Total states run:     1
Total run time:   0.000 ms

In previous versions I think this was followed by a helpful message telling me to install docker-py?

terminalmage commented 7 years ago

Do you have docker-py installed in your virtualenv?

terminalmage commented 7 years ago

Also, keep in mind docker-py in PyPI is the legacy module, the actively-developed one is just called docker

brianthelion commented 7 years ago

Yeah, that's confusing. I wasn't sure which to go with, and the docs weren't helping.

brianthelion commented 7 years ago

Did pip install docker and updated docker.image_present to docker_image.present and got the original error:

local:
----------
          ID: myuser/myimage:mytag
    Function: docker_image.present
      Result: False
     Comment: Encountered error pulling myuser/myimage:mytag: Unable to interpret API event: 'b'{"status":"Pulling repository docker.io/myuser/myimage"}\r\n''. Additional info follows:

              Error:
                  the JSON object must be str, not 'bytes'
     Started: 13:26:43.596839
    Duration: 422.801 ms
     Changes:   

Summary for local
------------
Succeeded: 0
Failed:    1
------------
Total states run:     1
Total run time: 422.801 ms
terminalmage commented 7 years ago

The docs for the upcoming release make this more clear:

https://docs.saltstack.com/en/develop/ref/states/all/salt.states.docker_container.html#module-salt.states.docker_container

Also, I noticed that the newly-created modules where we've split container, volume, image, and network management into their own state modules were not part of the table of contents in the docs, I've corrected that oversight in https://github.com/saltstack/salt/pull/42020.

brianthelion commented 7 years ago

@terminalmage So it looks like we're still seeing the bug on 2017.7. Are we still "info needed?"

terminalmage commented 7 years ago

OK, I see the problem. When I was developing this, I was using 3.6, which apparently can now automagically load bytestrings:

Python 3.6.1 (default, Mar 27 2017, 00:27:06)
[GCC 6.3.1 20170306] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import json
>>> json.loads(b'{"foo": "bar"}')
{'foo': 'bar'}
>>>

But on 3.5 and earlier, this raises an exception:

Python 3.5.1 (default, Mar  4 2016, 15:21:15)
[GCC 6.0.0 20160302 (Red Hat 6.0.0-0.14)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import json
>>> json.loads(b'{"foo": "bar"}')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib64/python3.5/json/__init__.py", line 312, in loads
    s.__class__.__name__))
TypeError: the JSON object must be str, not 'bytes'
>>>

This is fixed in #42022.

brianthelion commented 7 years ago

<digression> @terminalmage Thanks! Are you developing on 3.6 by default these days?

terminalmage commented 7 years ago

@brianthelion Not by default. For docker I have been developing locally on my laptop using the dockerd running there, and I run Arch so I have 2.7 and 3.6. But I also use docker containers for CentOS, Ubuntu, etc. to test the code on those platforms, with my git checkout mounted into the container, so in those cases I'll get 3.4 or 3.5 from time to time if I'm testing Python 3.

brianthelion commented 7 years ago

@terminalmage Interesting that Arch has moved on to 3.6 already. I'm wondering if I should pull the trigger and make the switch using the PPA version for Ubuntu. Some nice things in 3.6! </digression>

terminalmage commented 7 years ago

Indeed! For portability though, 3.4 is going to be the standard for a little while longer, I fear.

brianthelion commented 7 years ago

@terminalmage This is a blocker for me. If you can point me to some source that I can modify to get it working, I will patch the code myself.

terminalmage commented 7 years ago

@brianthelion it is literally a one-line fix, so it should be easy for you to work around locally. You can see the diff here in the PR I opened: https://github.com/saltstack/salt/pull/42022/files

If I may recommend, you can copy the file (in this case dockerng.py) from /usr/lib/python.... to within the salt fileserver under (salt://_modules/), make that one-line edit, and then run salt '*' saltutil.sync_modules. This will sync this module to your minions and override the one with the bug. Keep in mind that with this workaround you'll want to remove this file and re-run that sync when you upgrade, to keep this temporary workaround from remaining in place and potentially causing problems.

Also, as @gtmanfred mentioned earlier, we don't technically support Python 3 in the 2016.11 release cycle. The upcoming 2017.7.0 release will be the first with experimental Python 3 support. That said, I still very much appreciate you helping bring this to light as this fix will be very important for 2017.7.0.

brianthelion commented 7 years ago

@terminalmage Sorry to go out of band here, but I think I've hit a bug in 2017.7 while trying to resolve this issue. I'm seeing state.sls (hence, state.apply) not respecting the pillar= argument.

This can be verified by calling salt-call --local state.sls baz pillar='{"host": "localhost"}' where

#baz.sls
ping -c 2 {{ pillar['host'] }}:
  cmd.run

If you can confirm that this is failing, I'll file a bug report.

gtmanfred commented 7 years ago

If you open a bug report, we will confirm it before we tag it with labels.

Thanks, Daniel

On Tue, Jul 4, 2017 at 1:21 PM, brianthelion notifications@github.com wrote:

@terminalmage https://github.com/terminalmage Sorry to go out of band here, but I think I've hit a bug in 2017.7 while trying to resolve this issue. I'm seeing state.sls (hence, state.apply) not respecting the pillar= argument.

This can be verified by calling salt-call --local state.sls baz pillar='{"host": "localhost"}' where

baz.sls

ping -c 2 {{ pillar['host'] }}: cmd.run

If you can confirm that this is failing, I'll file a bug report.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/saltstack/salt/issues/41996#issuecomment-312937589, or mute the thread https://github.com/notifications/unsubscribe-auth/AAssoeu6ZOs9w4JybDKa0nlRLZuhc3oUks5sKpCkgaJpZM4OImzh .

terminalmage commented 7 years ago

@brianthelion I've confirmed it and submitted a fix in ~https://github.com/saltstack/salt/issues/42116~ https://github.com/saltstack/salt/issues/42119.

Ch3LL commented 7 years ago

@brianthelion were you able to resolve this issue with #42119 and #42022 ?

Ch3LL commented 7 years ago

Going to close the issue but please let us know if this does not resolve the issue for you and we can re-open

brianthelion commented 7 years ago

@Ch3LL Looks like the issue persists.

$ git log
commit 41ef5225e9f6495c017f41dda03dd4b592795dfd
Merge: 47ade9e91c e639be8b47
Author: garethgreenaway <gareth@wiked.org>
Date:   Thu Jul 6 16:04:01 2017 -0700

    Merge pull request #42184 from terminalmage/py3-tests

    importlib: Use load_module() instead of exec_module() to initialize loaded mods

commit 47ade9e91c9720d554d53a8701bb4c131d6786b8
Merge: 2ae5517d36 fc27c1a948
Author: garethgreenaway <gareth@wiked.org>
Date:   Thu Jul 6 15:03:42 2017 -0700

    Merge pull request #42088 from terminalmage/update-mocking

    Update mocking in network tests

commit e639be8b4742468b1acb79b8b4182e8737f0d4c1
Author: Erik Johnson <palehose@gmail.com>
Date:   Thu Jul 6 15:02:44 2017 -0500

    importlib: Use load_module() instead of exec_module() to initialize loaded mods

    Using exec_module() results in some unexpected behavior in the LazyLoader,
    so more investigation will need to be done before we can use it. In the
    meantime, this commit uses load_module() instead. It also gets rid of
    the now-unnecessary workarounds we had recently instituted in salt-ssh
    to work around issues with the __opts__ dunder.

commit 2ae5517d360d4bda9108ce6417ee483e74b3d1a8
Merge: 778ed74103 19df3bf731
Author: Nicole Thomas <nicole@saltstack.com>
Date:   Thu Jul 6 12:27:16 2017 -0600

    Merge pull request #42022 from terminalmage/issue41996

    salt.modules.dockermod: ensure that json.loads is fed a string
$ pip install --upgrade -e .
Obtaining file:///home/bar/Dev/foo/build/saltstack
Requirement already up-to-date: Jinja2 in /home/bar/Dev/foo/env/5/lib/python3.5/site-packages (from salt===2017.7.0rc1-10-g41ef522)
Requirement already up-to-date: msgpack-python>0.3 in /home/bar/Dev/foo/env/5/lib/python3.5/site-packages (from salt===2017.7.0rc1-10-g41ef522)
Requirement already up-to-date: PyYAML in /home/bar/Dev/foo/env/5/lib/python3.5/site-packages (from salt===2017.7.0rc1-10-g41ef522)
Requirement already up-to-date: MarkupSafe in /home/bar/Dev/foo/env/5/lib/python3.5/site-packages (from salt===2017.7.0rc1-10-g41ef522)
Requirement already up-to-date: requests>=1.0.0 in /home/bar/Dev/foo/env/5/lib/python3.5/site-packages (from salt===2017.7.0rc1-10-g41ef522)
Requirement already up-to-date: tornado>=4.2.1 in /home/bar/Dev/foo/env/5/lib/python3.5/site-packages (from salt===2017.7.0rc1-10-g41ef522)
Requirement already up-to-date: pycrypto>=2.6.1 in /home/bar/Dev/foo/env/5/lib/python3.5/site-packages (from salt===2017.7.0rc1-10-g41ef522)
Requirement already up-to-date: pyzmq>=2.2.0 in /home/bar/Dev/foo/env/5/lib/python3.5/site-packages (from salt===2017.7.0rc1-10-g41ef522)
Requirement already up-to-date: chardet<3.1.0,>=3.0.2 in /home/bar/Dev/foo/env/5/lib/python3.5/site-packages (from requests>=1.0.0->salt===2017.7.0rc1-10-g41ef522)
Requirement already up-to-date: idna<2.6,>=2.5 in /home/bar/Dev/foo/env/5/lib/python3.5/site-packages (from requests>=1.0.0->salt===2017.7.0rc1-10-g41ef522)
Requirement already up-to-date: urllib3<1.22,>=1.21.1 in /home/bar/Dev/foo/env/5/lib/python3.5/site-packages (from requests>=1.0.0->salt===2017.7.0rc1-10-g41ef522)
Requirement already up-to-date: certifi>=2017.4.17 in /home/bar/Dev/foo/env/5/lib/python3.5/site-packages (from requests>=1.0.0->salt===2017.7.0rc1-10-g41ef522)
Installing collected packages: salt
  Found existing installation: salt 2017.7.0rc1-10-g41ef522
    Uninstalling salt-2017.7.0rc1-10-g41ef522:
      Successfully uninstalled salt-2017.7.0rc1-10-g41ef522
  Running setup.py develop for salt
Successfully installed salt
[DEBUG   ] Attempting to run docker-py's "images" function with args=() and kwargs={'all': False}
[DEBUG   ] Attempting to run docker-py's "build" function with args=() and kwargs={'nocache': False, 'buildargs': None, 'rm': True, 'path': '/home/bar/Dev/foo/build/salt/._cache/venv-jglf6sfo/tmp', 'fileobj': None, 'dockerfile': None, 'quiet': False, 'tag': 'foo:latest'}
[DEBUG   ] Looking for auth config
[DEBUG   ] No auth config in memory - loading from filesystem
[DEBUG   ] Trying paths: ['/home/bar/.docker/config.json', '/home/bar/.dockercfg']
[DEBUG   ] No config file found
[DEBUG   ] No auth config found
[ERROR   ] Encountered error building /home/bar/Dev/foo/build/salt/._cache/venv-jglf6sfo/tmp as foo:latest: the JSON object must be str, not 'bytes'
[INFO    ] Completed state [foo:latest] at time 20:50:37.422752 duration_in_ms=87.28
Ch3LL commented 7 years ago

@terminalmage see above ^

brianthelion commented 7 years ago

@terminalmage @Ch3LL I unblocked myself by moving from docker_image.present: -build: to docker_image.present: -sls: and implementing support for #42202.

This issue is still open.

Ch3LL commented 7 years ago

@brianthelion can you give https://github.com/saltstack/salt/pull/42208 a try?

brianthelion commented 7 years ago

@Ch3LL Pulled and will report back shortly....

brianthelion commented 7 years ago

@Ch3LL Looks good! I'll call to reopen if I hit anything else.

terminalmage commented 7 years ago

@brianthelion Thanks a lot for helping with getting this tested and verified. I'll go ahead and close this.