Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

333 use logger in place of print #13

Open
wants to merge 183 commits into from

9 participants

@ramonvanalteren

Hey,

Updated branch to latest master and fixed all testcases.

Remaining issue:

The way the console logger is setup now is to print all output to stderr.
For any logmessages above warning that seems reasonable, however anything of the lower levels should probably go to stdout ?

The only way I can see how to do that is to subclass StreamHandler

kcbanner and others added some commits
@kcbanner kcbanner Added exlude hosts functionality 85fe7bd
@goosemo Added in the little bit more to the docs on the local_dir var. 0f9a1c5
@goosemo Pulling the the patches to upload_project made by Rodrigue Alcazar
From [issue #10](http://code.fabfile.org/issues/show/10) I am pulling in the
patch and unit tests that he's made. I'll tweak them as needed, but the intial
pull looks good.
3445b56
@goosemo Made a minor adjustment to use strip(os.sep) instead of array indexing. 32f7d67
@goosemo Merge http://github.com/bitprophet/fabric into 10-project-upload 215bf88
@goosemo Merge branch 'feature184' of github.com:goosemo/fabric into 10-projec…
…t-upload
206b0c6
@goosemo This adds a decorator to make the host list follow order
@ensure_order on a task will side step the use of set() to dedupe, and will
instead loop over the host and role lists reappending to temp list if not
already present in the temp list.

Something to do then as an addition/extension, would be to perhaps add a
parameter on the decorator to sort the list.
01f6c5c
@goosemo Added in sorted parameter to the @ensure_order decorator 540fcf2
@goosemo Merge branch 'ensure_order' of github.com:goosemo/fabric into 115-ens…
…ure-order
e12c0e2
@goosemo Cleaned out testing prints 2054be1
@goosemo Wrote up more in the docstring and added it to be included in the docs. a86f293
@goosemo Merge branch 'master' of github.com:goosemo/fabric into 10-project-up…
…load
b955fef
@goosemo Changed the local_dir to rstrip keeping tests passing. 7d033f7
@tswicegood tswicegood Adds a @with_settings decorator for tasks (and tests) to use
A simple wrapper around the settings context_manager.  Useful for
retrofitting old code without having to indent it all for the context
block.

Signed-off-by: Morgan Goose <morgan.goose@gmail.com>
cf61564
@tswicegood tswicegood add docblock explaining what with_settings does
Signed-off-by: Morgan Goose <morgan.goose@gmail.com>
a99a54a
@tswicegood tswicegood Modify tests to pass using the new context.
Both tests assume a env.use_shell to be True.  There's a test somewhere
else in the chain that can cause this to not be the case.  This ensures
the assumption is always met.

Signed-off-by: Morgan Goose <morgan.goose@gmail.com>
8a258ea
@goosemo After getting in patches from Travis' fork, I also added it to the sp…
…hinx docs and an example.
e09319b
@goosemo Merge branch 'master' of github.com:goosemo/fabric into 184-rsync-pro…
…ject-local-dir-doc-update
264b091
@mitechie mitechie Fixes #307 Update code to match Pep8 standards
- I've updated most of the code to match PEP8. There are a few valid exceptions
left behind
- Note, stripping trailing whitespace from "expecting" strings in
test_networks.py will break tests
422268b
@mitechie mitechie Fixes 113 updates to allow tuples as host/rols lists
- Added test for roles and hosts as tuples
- Add new decorator for testing @with_patched_state_env to better mock out a
full state.env
- updated the new tests to use ^^ decorator
76f7f86
@mitechie mitechie Update tests in test_main to use decorator to mock state.env 7a5347c
@goosemo Fixed minor issue in changes to tests.utils imports conflicting a60ea6e
@goosemo Merge branch 'master' of github.com:goosemo/fabric into 184-rsync-pro…
…ject-local-dir-doc-update
6eb8be0
@goosemo Fixed imports issue causing merge conflict. 8e18071
@goosemo Merge branch 'master' of github.com:goosemo/fabric into 10-project-up…
…load
38081c4
@thomasballinger thomasballinger Added args to upload_template for mode support
Addesses issue #117: Add mode support to upload_template()
Appears to address #304, Rewrite upload_template to make use of
new put() features.
dd11efe
@bitprophet bitprophet Update attribution re #312 bc0fe58
@bitprophet bitprophet Fix #310 - use octal, not string rep 5afe16f
@bitprophet bitprophet Update changelog re: #320 cbdfc06
@bitprophet bitprophet Bump version to 1.0.1 final 5b70772
@goosemo Merge branch 'master' of github.com:goosemo/fabric into 10-project-up…
…load
67c97a6
@goosemo Fixed conflict 8495a44
@goosemo Merge branch 'master' of github.com:goosemo/fabric into 283-with-sett…
…ings-decorator
e611cfc
@goosemo Think this does what jeff had suggested. 782a18b
@aleszoulek aleszoulek added backup_file argument to upload_template() ac8ff96
@goosemo Merged in Travis Swicegood's fix for #125
I had to pull it out by hand because the patch wouldn't apply, and I also
wanted to make a change and hide the main function of append and write, much
like run and sudo use a hidden command and are just place holders that enact
specific defaults.

Anyhow it's a direct pull from this commit:
    https://github.com/tswicegood/fabric/blob/cc853f165e9b1b2c177579a16e97be16cc9b40d6/fabric/contrib/files.py
886c20f
@goosemo Merge branch 'master' of github.com:goosemo/fabric into 184-rsync-pro…
…ject-local-dir-doc-update
9e15824
@goosemo Merged in Casey Banner's work for #170, Fixed conflicts and also made…
… a failing test pass.
2bb769d
@goosemo Added in docs for this branch as well. b825a44
@goosemo Added in case insensitive flag 9478ebc
@goosemo Merge branch '117-add-mode-support-to-upload-template' of https://git…
…hub.com/thomasballinger/fabric into 117-add-mode-support-to-upload-template
7c40673
@goosemo Made up some docs for this feature. dcd9564
@goosemo Merge branch '36-state-connections-import-refactor' into 1.1 b7c2ffb
@goosemo Merge branch '115-ensure-order' into 1.1 4626235
@goosemo Merge branch '273-upload-template-backup-file-option' into 1.1 cf4b95c
@goosemo Merge branch '307-pep8' into 1.1 e0b0d47
@goosemo Merge branch '314-update-test-mocks' into 1.1
Conflicts:
	fabric/main.py
	tests/test_main.py

Fixed the conflicts as well as edited the decorated tests. So now intead of
using a patched object we use @with_patched_sate_env()
71ab7be
@goosemo Merge branch '10-project-upload' into 1.1 dc80193
@goosemo Merge branch '117-add-mode-support-to-upload-template' into 1.1
Conflicts:
	fabric/contrib/files.py

Fixed conflicts between this mode change and the backup feature.
66f80c0
@goosemo Merge branch '125-also-be-able-to-write-to-file-contrib' into 1.1 0b1352a
@goosemo Merge branch '154-sed-case-insensitive' into 1.1 85a501d
@goosemo Merge branch '170-exclude-hosts' into 1.1
Conflicts:
	docs/usage/execution.rst
	docs/usage/fab.rst
	fabric/main.py
	fabric/state.py
	tests/test_main.py

Had to address the conflict resolutions. Needed to put the exclusion bits for
hosts towards the bottom below my ensures order stuff. I then needed to make
all the tests right, by adding in the extra [] now required in any tests using
get_hosts.

I also addressed a bug I'd let slip in for contrib.files where I'd made syntax
error in the mode and backup merge.

Now all tests pass.
89f06e7
@goosemo Merge branch '184-rsync-project-local-dir-doc-update' into 1.1 e4b9f4d
@goosemo Merge branch '283-with-settings-decorator' into 1.1
Conflicts:
	docs/api/core/decorators.rst
	fabric/decorators.py

Simple conflicts to resolve, just that the two decorators ensures_order and
with_settings, were both developed in parallel, so they just wanted to insert
into the same place on the merge. Just removed the merge chars and fixed the
rst to resolve.
fb261d5
@goosemo Forgot to add it to the api 9fdd0d6
@goosemo Forgot to add it to the api 62237f6
@goosemo Merge branch '115-ensure-order' into 1.1 58798ee
@goosemo Merge branch '283-with-settings-decorator' into 1.1
Conflicts:
	fabric/api.py
f5cb3fc
@goosemo M the main env variable for ensure_order public 598e0ba
@goosemo Added in some docs for the env.ensure_order 10b8295
@goosemo Merge branch '115-ensure-order' into 1.1 b55436e
@bitprophet bitprophet Update PyPI-oriented changelog link re: RTD architecture tweaks bb9b486
@bitprophet bitprophet Update PyPI-oriented changelog link re: RTD architecture tweaks 0ef63c8
@goosemo Fixed issue with 2.5 compat
Got a report from Vladimir Lazarenko on irc that using the 1.1 branch which
includes this, was raising an error:

.../fabric/decorators.py:162: Warning: 'with' will become a reserved keyword in Python 2.6

This cropped up because I'd forgotten to make the from __future__ import in the
decorators module.
c13dbb4
@goosemo Merge branch '283-with-settings-decorator' into 1.1 cc77d60
@goosemo Merge branch '1.1' of github.com:goosemo/fabric into 1.1 48e8b4d
@goosemo Merge branch 'master' of github.com:goosemo/fabric into 1.1 3bc62f7
@bitprophet bitprophet Update cd() docs to explicitly reference lcd() 30f3307
@bitprophet bitprophet Changelog for previous commit a0e57dd
@bitprophet bitprophet Merge branch '1.0' f66947b
@goosemo Merge branch 'master' into 1.1 9c610db
@bitprophet bitprophet Reimplement with cleaner patched-env decorator.
Closes #314
9399a20
@bitprophet bitprophet Add changelog entry re #307 33cc7e2
@bitprophet bitprophet Refactor test runner classes f947854
@bitprophet bitprophet Add another test file helper 6861024
@bitprophet bitprophet Re #273, fix remote filename bug cd25547
@bitprophet bitprophet Fix file path munging and add another test
Re #273
d7470d2
@bitprophet bitprophet Add changelog entries re #273 c88f7c0
@bitprophet bitprophet Dev branches really ought to have a dev version 1773ce0
@bitprophet bitprophet Re #184, add changelog entry and tweak language 626ade6
@bitprophet bitprophet Update AUTHORS file re #273 fb3aaae
@bitprophet bitprophet Move --exclude-hosts docs into its own section, and update changelog/…
…AUTHORS

Re #170.
d15edb4
@bitprophet bitprophet Beef up docs, add default env value re #170 aec6376
@bitprophet bitprophet Update case-insensitive sed flag to be generic.
Also beef up docs. Re #154
0e1ae0d
@bitprophet bitprophet Add attribution to changelog re: #154.
Implements #154
47ea5a5
@imankulov imankulov Fix bug with fabric.api.put(...)
``mode`` kwarg didn't take effect while uploading file-like objects
67d32d5
@bitprophet bitprophet Add changelog, AUTHORS and fixes #337 9a13102
@bitprophet bitprophet Merge branch '1.0' 222d83f
@bitprophet bitprophet Merge branch 'master' into 1.1
Conflicts:
	AUTHORS
7397953
@bitprophet bitprophet Integration patching & changelog; fixes #117 98aceb2
@bitprophet bitprophet Revert patch re #36 a47054e
@bitprophet bitprophet Changelog, AUTHORS, docstring, reformat re #10. Imps #10. 7c47972
@bitprophet bitprophet Add missing versionchanged directives to docstrings 5ffd0a0
@bitprophet bitprophet Revert goosemo's patches re #115 86a1182
@bitprophet bitprophet Implements #115 - don't use set() to dedupe host lists b4ed89a
@bitprophet bitprophet Changelog, docstring tweaks, imps #283 87044bb
@bitprophet bitprophet Revert #125 b0c7162
@bitprophet bitprophet Fixes #258 - Windows local logic inversion fix 2e90af6
@bitprophet bitprophet Merge branch '1.0' 5d27faa
@bitprophet bitprophet Fixes #347 - test for StringTypes not str 7d99ba0
@bitprophet bitprophet Merge branch '1.0' 3b4d8dd
@bitprophet bitprophet Merge branch 'master' into 1.1 c3e79b6
@bitprophet bitprophet Make git branches report themselves as alphas, derp 3e040a3
@bitprophet bitprophet Clarify rsync_project docstring re: trailing slashes ef696c3
@bitprophet bitprophet Merge branch '1.0' 349cd05
@bitprophet bitprophet Merge branch 'master' into 1.1
Conflicts:
	fabric/version.py
65c5060
@bitprophet bitprophet Apply patch derived from goosemo/76-task-decorator
* git diff 1.1...goosemo/76-task-decorator > 76.diff
* git apply -v --check 76.diff
* hack hack hack
* git apply 76.diff

Removed a handful of minor tweaks not relevant to the feature at hand.
a6c13cd
@bitprophet bitprophet Update test env munging e8f19ef
@bitprophet bitprophet Bit of cleanup db219e7
@bitprophet bitprophet callable is a builtin :) 67d1a76
@bitprophet bitprophet Update run/sudo combine_stderr for overriding.
Fixes #324.
851b796
@bitprophet bitprophet Re #324, tests and an important fix they caught 89e97c1
@bitprophet bitprophet Merge branch '1.0' into 1.1 6800328
@bitprophet bitprophet Merge branch '1.0' 72bed2a
@bitprophet bitprophet WIP re #76.
TODO:
* Figure out package-related stuff -- remind self how vanilla Python
  package recursive imports work, make sure it's applied consistently
  (re namespacing)
* Update code to be consistent with new docs
* Ensure changelog, AUTHORS updated
7b1f568
@bitprophet bitprophet Reword how @task helps with namespaces cb4461c
@bitprophet bitprophet start not using module level constants 2b27bd6
@bitprophet bitprophet Big fleshing-out of docs re #76 af6bbfa
@bitprophet bitprophet Many small tweaks to docs, docstrings re #76 2e49f1d
@bitprophet bitprophet Add changelog entry for #76, #56 c3068ae
@bitprophet bitprophet Edits to task docs 79f6b7d
@bitprophet bitprophet Clarify behavior of __all__ 4fee934
@bitprophet bitprophet Few edits to the classic tasks section 0084db6
@bitprophet bitprophet Handle oddball non string __doc__ attributes f16d8df
@bitprophet bitprophet WIP re: task discovery updates fcf3e9e
@bitprophet bitprophet Whitespace 35c3480
@bitprophet bitprophet Commenting aa7f9b3
@bitprophet bitprophet Cleanup of namespace/task-decorator tests re #76, re #56 d7a7670
@bitprophet bitprophet Merge branch '76-task-decorator' of git.fabfile.org:fabric into 76-ta…
…sk-decorator
601a771
@bitprophet bitprophet Missed a spot f605730
@bitprophet bitprophet Refactor 89724bf
@bitprophet bitprophet Couple new tests 07bad3f
@bitprophet bitprophet Cleaner, reversible seen-module caching c662099
@bitprophet bitprophet Merge branch 'master' into 1.1 5c9ca83
@bitprophet bitprophet Merge branch '1.1' into 76-task-decorator 18d5c3d
@bitprophet bitprophet Re #56, add -F option and rearrange a bit 47f20d8
@bitprophet bitprophet Sick of having eq_ args swapped 3c0af2f
@bitprophet bitprophet Don't print the 'aka' unless repr != str 363c719
@bitprophet bitprophet Break ground on tests, use explicit commands obj in main
Re #56
d0d22a9
@bitprophet bitprophet Minor tweaks c4bcd8d
@bitprophet bitprophet Implement nested output.
Also rejiggers a ton of stuff for arguably cleaner handling of namespace
trees.
10b9b73
@bitprophet bitprophet Bugfix and test b2b27ac
@bitprophet bitprophet Re #56, tweak nested output & clean up tests 9d3280b
@bitprophet bitprophet Document nested output and -F re #56 d4ce7c9
@bitprophet bitprophet Implements #189: flag for aborting-on-prompts 5d8d0e3
@bitprophet bitprophet Make doc browsing its own task 8a0023f
@bitprophet bitprophet Bugfix: excluding hosts broke remainder tasks 05aca97
@bitprophet bitprophet Implements #353: SSH keepalive.
Based on a cherry-pick of 81e57d7
d68b7ac
@bitprophet bitprophet Make doc browsing its own task a4a6b08
@bitprophet bitprophet Reorder eq_ args 0034a82
@bitprophet bitprophet Use FabricTest to isolate namespace tests 8905aaf
@bitprophet bitprophet Re #56, don't allow leaf classic modules to pollute new-style trees 465f813
@bitprophet bitprophet Dogfooding: use new-style tasks, namespaces in core fabfile 7aff0af
@bitprophet bitprophet Fixes #329: reboot() broken for partial host strings
Conflicts:

	fabric/network.py
3f5503e
@bitprophet bitprophet Note that 1.0.2 will contain 0.9.7 6f8a80a
@bitprophet bitprophet Merge branch '1.0'
Conflicts:
	fabfile/__init__.py
594211b
@bitprophet bitprophet Add 1.0.2 note to 1.1 release docs 9be5e03
@bitprophet bitprophet Add test re #329
Conflicts:

	tests/test_network.py
3c56186
@bitprophet bitprophet Merge branch '1.0'
Conflicts:
	tests/test_network.py
0f77dca
@bitprophet bitprophet Formatting 835a094
@bitprophet bitprophet Fix I/O race condition
Fixes #352, fixes #320
efd9fef
@bitprophet bitprophet Merge branch '1.0'
Conflicts:
	AUTHORS
95127ac
@bitprophet bitprophet Fixes #345, contains() returns boolean, not retval. 7f6cbc9
@bitprophet bitprophet Silly/shitty little sanity-test runner 0d74105
@bitprophet bitprophet Merge branch '1.0' cde6aab
@bitprophet bitprophet Version bump for 1.0.2 0de7dca
@bitprophet bitprophet Version bump for 1.1 3b7150e
@bitprophet bitprophet Dev version for 1.1.1 ef2cc5f
@bitprophet bitprophet Dev version for 1.2 2adbf18
@bitprophet bitprophet Enhance docs on Task subclass usage 3ff8b55
@bitprophet bitprophet Task decorator must be first 2c7b692
@bitprophet bitprophet Update tag list for manually generated docs 4b6a1f6
@bitprophet bitprophet Fix up docs.push 13b57d1
@bitprophet bitprophet Merge branch '1.1.0-docs' into 1.1 3b52a83
@bitprophet bitprophet Merge branch '1.1'
Conflicts:
	fabric/version.py
a699229
@bitprophet bitprophet Fix main loop to look for Task.run() 942601c
@bitprophet bitprophet Remove confusing, extraneous note re: example 28ffb4c
@bitprophet bitprophet Merge branch '1.1.0-docs' into 1.1 11f18f6
@bitprophet bitprophet Merge branch '1.1' b8619fc
@ramonvanalteren ramonvanalteren Merge remote-tracking branch 'upstream/master' into logging
* upstream/master: (123 commits)
  Remove confusing, extraneous note re: example
  Fix main loop to look for Task.run()
  Fix up docs.push
  Update tag list for manually generated docs
  Task decorator must be first
  Enhance docs on Task subclass usage
  Dev version for 1.2
  Dev version for 1.1.1
  Version bump for 1.0.2
  Silly/shitty little sanity-test runner
  Fixes #345, contains() returns boolean, not retval.
  Fix I/O race condition
  Formatting
  Add test re #329
  Add 1.0.2 note to 1.1 release docs
  Note that 1.0.2 will contain 0.9.7
  Fixes #329: reboot() broken for partial host strings
  Dogfooding: use new-style tasks, namespaces in core fabfile
  Re #56, don't allow leaf classic modules to pollute new-style trees
  Use FabricTest to isolate namespace tests
  ...

Conflicts:
	fabric/main.py
	fabric/network.py
	fabric/operations.py
77eb80d
@ramonvanalteren ramonvanalteren Patching the logging stream in mock_streams as well
Because logging gets initialized early in the game, mock_streams is not working.
The logging output goes to the actual stderr stream and not to the mocked stream.
d9e75f7
@ramonvanalteren ramonvanalteren Fixed a set of testcases
In some cases there was a mismatch between what was actually printed through the logger and what was expected
Some of the testcases swapped expected and actual output

In addition there is a fundamental change hidden here:

The console logger will output by default to stderr
This is probably fine for warn/fatal etc messages, however it is a bit dubious for info messages.
In some cases I had to change the stream the testcase got the results from to stdall to get it working.
dc913d2
@ramonvanalteren ramonvanalteren Fixing up messages with different expectations in the test bd8b716
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.