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

RequestContext (w/lint) #28249

Closed
wants to merge 7 commits into from
Closed

Conversation

cachedout
Copy link
Contributor

Refs #27843 and adds some small lint fixes.

jacksontj and others added 7 commits October 22, 2015 18:41
finally will be run even if self.exit() is called.

```
Traceback (most recent call last):
  File "/home/jacksontj/.virtualenvs/salt/bin/salt-run", line 10, in <module>
    execfile(__file__)
  File "/home/jacksontj/src/salt/scripts/salt-run", line 10, in <module>
    salt_run()
  File "/home/jacksontj/src/salt/salt/scripts.py", line 337, in salt_run
    client.run()
  File "/home/jacksontj/src/salt/salt/cli/run.py", line 47, in run
    if isinstance(ret, dict) and 'retcode' in ret:
UnboundLocalError: local variable 'ret' referenced before assignment
```
Inspired by saltstack#23373

The basic issue we ran into is that the loader is injecting globals directly into the global namespace. This means that these injected values are not thread or coroutine safe-- meaning we can never do more than one thing at a time. Instead of multiprocessing everything to death-- we can simply use a stack_context to nicely handle this down in the core. As far as the module authors/users are concerned nothing has changed-- but the storage behind the scenes is now per-JID. This same set of classes can easily be used to store additional data (next candidates are reactors, master MWorker tasks, etc.).
While debugging in here I noticed that the style varied a bit-- so this normalizes it to one clean one :)
@cachedout cachedout mentioned this pull request Oct 23, 2015
@jfindlay jfindlay added Core relates to code central or existential to Salt Expert Change Loader labels Oct 23, 2015
@cachedout cachedout closed this Oct 26, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Core relates to code central or existential to Salt Loader
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants