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

Fix salt-ssh state.sls_id TypeError key must be a string #48822

merged 1 commit into from Jul 30, 2018


None yet
2 participants

Ch3LL commented Jul 30, 2018

What does this PR do?

Currently the test integration.ssh.test_state.SSHStateTest.test_state_sls_id is failing with error:

Traceback (most recent call last):
  File "/tmp/kitchen/testing/tests/integration/ssh/", line 65, in test_state_sls_id
    exp_ret='The file /tmp/test is set to be changed')
  File "/tmp/kitchen/testing/tests/integration/ssh/", line 31, in _check_dict_ret
    self.assertIsInstance(ret, dict)
AssertionError: "Target 'localhost' did not return any data, probably due to an error." is not an instance of <class 'dict'>

I found out its not returning any data because of this stack trace when running salt-ssh

Traceback (most recent call last):
  File "/usr/lib/python3.6/multiprocessing/", line 258, in _bootstrap
  File "/home/ch3ll/git/salt/salt/utils/", line 747, in _run
    return self._original_run()
  File "/usr/lib/python3.6/multiprocessing/", line 93, in run
    self._target(*self._args, **self._kwargs)
  File "/home/ch3ll/git/salt/salt/client/ssh/", line 522, in handle_routine
    stdout, stderr, retcode =
  File "/home/ch3ll/git/salt/salt/client/ssh/", line 995, in run
    stdout, retcode = self.run_wfunc()
  File "/home/ch3ll/git/salt/salt/client/ssh/", line 1170, in run_wfunc
    ret = salt.utils.json.dumps({'local': {'return': result}})
  File "/home/ch3ll/git/salt/salt/utils/", line 145, in dumps
    return json_module.dumps(obj, **kwargs)  # future lint: blacklisted-function
  File "/usr/lib/python3.6/json/", line 238, in dumps
  File "/usr/lib/python3.6/json/", line 199, in encode
    chunks = self.iterencode(o, _one_shot=True)
  File "/usr/lib/python3.6/json/", line 257, in iterencode
    return _iterencode(o, 0)
TypeError: keys must be a string

This is because state.sls_id is returning bytes on 2018.3 so using decode() to convert the returned dict's keys back to strings.

What issues does this PR fix or reference?

Fixes saltstack/salt-jenkins#1043

Tests written?

Fixes a test

Commits signed with GPG?




@rallytime rallytime merged commit 16ca4ec into saltstack:2018.3 Jul 30, 2018

5 of 7 checks passed

jenkins/pr/py2-centos-7 running py2-centos-7...
jenkins/pr/py3-centos-7 running py3-centos-7...
WIP ready for review
continuous-integration/jenkins/pr-merge This commit looks good
jenkins/pr/lint The lint job has passed
jenkins/pr/py2-ubuntu-1604 The py2-ubuntu-1604 job has passed
jenkins/pr/py3-ubuntu-1604 The py3-ubuntu-1604 job has passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment