tempfile.gettempdir() is way better. The gem and rvm states are
still failing, but only because they require the "mock" python
module for running their tests.
This will print a stacktrace of the currently running code when any
of the salt-minion or salt-master processes are sent a SIGUSR1 signal.
This is for seeing what's going on and to help with debugging.
Minion example:
======== Salt Debug Stack Trace =========
File "/home/jeff/git/salt/scripts/salt-minion", line 18, in <module>
main()
File "/home/jeff/git/salt/scripts/salt-minion", line 15, in main
minion.start()
File "/home/jeff/git/salt/salt/__init__.py", line 202, in start
minion.tune_in()
File "/home/jeff/git/salt/salt/minion.py", line 510, in tune_in
time.sleep(0.05)
=========================================
Master watchdog process example:
======== Salt Debug Stack Trace =========
File "/home/jeff/git/salt/scripts/salt-master", line 17, in <module>
main()
File "/home/jeff/git/salt/scripts/salt-master", line 14, in main
master.start()
File "/home/jeff/git/salt/salt/__init__.py", line 110, in start
master.start()
File "/home/jeff/git/salt/salt/master.py", line 192, in start
reqserv.run()
File "/home/jeff/git/salt/salt/master.py", line 304, in run
self.__bind()
File "/home/jeff/git/salt/salt/master.py", line 286, in __bind
zmq.device(zmq.QUEUE, self.clients, self.workers)
=========================================
Master worker example:
======== Salt Debug Stack Trace =========
File "/home/jeff/git/salt/scripts/salt-master", line 17, in <module>
main()
File "/home/jeff/git/salt/scripts/salt-master", line 14, in main
master.start()
File "/home/jeff/git/salt/salt/__init__.py", line 110, in start
master.start()
File "/home/jeff/git/salt/salt/master.py", line 158, in start
clear_old_jobs_proc.start()
File "/usr/lib/python2.6/multiprocessing/process.py", line 104, in start
self._popen = Popen(self)
File "/usr/lib/python2.6/multiprocessing/forking.py", line 99, in __init__
code = process_obj._bootstrap()
File "/usr/lib/python2.6/multiprocessing/process.py", line 232, in _bootstrap
self.run()
File "/usr/lib/python2.6/multiprocessing/process.py", line 88, in run
self._target(*self._args, **self._kwargs)
File "/home/jeff/git/salt/salt/master.py", line 145, in _clear_old_jobs
time.sleep(60)
=========================================
I'm sure there are places missed as this needs a *lot* more testing,
but for the moment, it "works for me TM"
The unless and onlyif checks should be executed with the same working
directory, user, group, shell, and environment as the command itself.
Take this example for instance:
createuser --no-superuser --no-createdb --no-createrole joe:
cmd.run:
- unless: psql --tuples-only -c 'SELECT rolname FROM
pg_catalog.pg_roles;' | grep '^joe$'
- user: postgres
Before this fix this state will fail during the unless check since its
beeing executed by root in a normal PostgreSQL setup.
In addition a bug where the effective gid was not reset when the
state returned early was fixed.
Added code coverage outputs genereated by
coverage.py to .gitignore . To generate code
coverage report, run this command:
coverage run tests/runtests.py
To produce HTML coverage repot (`htmlcov/index.html`):
coverage html --omit=tests/*
To produce Cobertura compliant XML for Jenkins:
coverage xml --omit=tests/*
Fixing:
- Standardizing on formatting:
CLI Example: -> CLI Example::
Usage:: -> CLI Example::
- Making sure all function names match their examples
- Other minor formatting issues
The option parsing logic has changed without affecting the test
invocation commandline interface.
So, it should be possible to invoke tests like this:
python tests/runtests.py -u #only run unit tests
python tests/runtests.py -m #only run module tests
python tests/runtests.py #run all tests
python tests/runtests.py -v #run all tests with verbose output
python tests/runtests.py -vu #run unit tests with verbose output