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

runners.state.orch: generate jid if missing #49759

Merged
merged 3 commits into from Sep 26, 2018

Conversation

Projects
None yet
4 participants
@mattp-
Copy link
Contributor

commented Sep 24, 2018

What does this PR do?

via salt-run cli a jid is generated in RunnerClient via gen_async_pub and passed on via orchestration_jid if the func is orchestration, but in other callsites this jid generation doesn't happen (ie, the netapi client, since it directly invokes AsyncMixins.cmd_sync). There seems to be no obvious way to correct this at the netapi level so we just default to a new jid if orch_jid is missing. there may be other calling contexts where this could have been occurring.

What issues does this PR fix or reference?

n/a

Previous Behavior

nested / parallel orchestrations called from salt-api failed/threw a stacktrace resulting from a missing jid like:

  File \"/home/mphillips81/repos/salt/salt/client/mixins.py\", line 374, in low
    data['return'] = func(*args, **kwargs)
  File \"/home/mphillips81/repos/salt/salt/runners/state.py\", line 123, in orchestrate
    orchestration_jid=orchestration_jid)
  File \"/home/mphillips81/repos/salt/salt/modules/state.py\", line 1326, in sls
    ret = st_.state.call_high(high_, orchestration_jid)
  File \"/home/mphillips81/repos/salt/salt/state.py\", line 2789, in call_high
    ret = self.call_chunks(chunks)
  File \"/home/mphillips81/repos/salt/salt/state.py\", line 2159, in call_chunks
    if self.reconcile_procs(running):
  File \"/home/mphillips81/repos/salt/salt/state.py\", line 2232, in reconcile_procs
    ret_cache = os.path.join(self.opts['cachedir'], self.jid, _clean_tag(tag))
  File \"/home/mphillips81/.pyenv/versions/2.7.14/lib/python2.7/posixpath.py\", line 68, in join
    if b.startswith('/'):
AttributeError: 'NoneType' object has no attribute 'startswith'

New Behavior

they work, as a jid is always generated.

Tests written?

No

Commits signed with GPG?

Yes/No

Please review Salt's Contributing Guide for best practices.

See GitHub's page on GPG signing for more information about signing commits with GPG.

state.orch: generate jid if missing
via salt-run cli a jid is generated in RunnerClient via gen_async_pub
and passed on via orchestration_jid if the func is orchestration, but in
other callsites this jid generation doesn't happen (ie, the netapi client,
since it directly invokes AsyncMixins.cmd_sync). There seems to be no
obvious way to correct this at the netapi level so we just default to
a new jid if orch_jid is missing. there may be other calling contexts
where this could have been occurring.

@mattp- mattp- changed the title state.orch: generate jid if missing runners.state.orch: generate jid if missing Sep 24, 2018

@cachedout
Copy link
Collaborator

left a comment

Very nice.

@rallytime rallytime merged commit 3c488a8 into saltstack:develop Sep 26, 2018

5 of 11 checks passed

jenkins/pr/py2-centos-7 running py2-centos-7...
Details
jenkins/pr/py2-ubuntu-1604 running py2-ubuntu-1604...
Details
jenkins/pr/py2-windows-2016 running py2-windows-2016...
Details
jenkins/pr/py3-centos-7 running py3-centos-7...
Details
jenkins/pr/py3-ubuntu-1604 running py3-ubuntu-1604...
Details
jenkins/pr/py3-windows-2016 running py3-windows-2016...
Details
WIP ready for review
Details
codeclimate All good!
Details
continuous-integration/jenkins/pr-merge This commit looks good
Details
jenkins/pr/docs The docs job has passed
Details
jenkins/pr/lint The lint job has passed
Details

rallytime added a commit that referenced this pull request Sep 26, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.