-
Notifications
You must be signed in to change notification settings - Fork 41
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
Make Labcontroller compatible with Python 2 and Python 3 #227
Closed
Closed
Changes from 1 commit
Commits
Show all changes
81 commits
Select commit
Hold shift + click to select a range
557e290
feat: enable lab-controller build for Python 3
StykMartin 6783017
fix(async): rename module to avoid use of reserved keyword
StykMartin 046ec78
fix(test): use range instead of xrange
StykMartin b3b291c
fix(test): update exception syntax for Python 3 compatibility
StykMartin 8bd61eb
fix(watchdog): use six to provide xmlrpc client
StykMartin 59ca7ed
fix(watchdog): update exception syntax for Python 3 compatibility
StykMartin 2d257ed
chore(watchdog): format code and sort imports
StykMartin d015ee2
chore(utils): format code and sort imports
StykMartin 97f1633
fix(transfer): update exception syntax for Python 3 compatibility
StykMartin 160f2d8
chore(transfer): format code and sort imports
StykMartin e182e16
fix(transfer): handle SSL error on Python 6
StykMartin fe53e5a
chore(test): format code and sort imports
StykMartin 392ae39
fix(test): use proper octal format
StykMartin 1babbbe
fix(pxemenu): use xmlrpc client and urllib from six
StykMartin b365a10
chore(pxemenu): format code and sort imports
StykMartin 6a00b9a
fix(proxy): update exception syntax for Python 3 compatibility
StykMartin f8c3eea
fix(proxy): use xmlrpc move from six
StykMartin 4698017
chore(proxy): format code and sort imports
StykMartin df27135
fix(provision): use xmlrpc move from six
StykMartin 257de1c
fix(provision): use unicode from six
StykMartin 97b3d7b
fix(provision): update exception syntax for Python 3 compatibility
StykMartin ceb0a39
fix(provision): handle iterators and dict with six
StykMartin cd9aecd
chore(provision): format code and sort imports
StykMartin f315c74
fix(netboot): import StringIO from six
StykMartin 087709f
fix(netboot): use urllib from six
StykMartin 08a8953
fix(netboot): use file mode compatible with six
StykMartin a078345
chore(netboot): format code and sort imports
StykMartin 13505c8
fix(proxy-main): update exception syntax for Python 3 compatibility
StykMartin 278181b
fix(proxy-main): make xmlrpc imports compatible
StykMartin 8b842b6
chore(proxy-main): format code and sort imports
StykMartin 96efb20
fix(log-storage): update exception syntax for Python 3 compatibility
StykMartin f9bdd1e
fix(log-storage): use proper octal format
StykMartin 8842505
chore(log-storage): format code and sort imports
StykMartin 40e6bb3
fix(pxemenu): use xmlrpc client and urllib from six
StykMartin 2a9fbe2
chore(expire-distros): format code and sort imports
StykMartin 283e3fd
fix(distro-import): update exception syntax for Python 3 compatibility
StykMartin ca713cd
fix(distro-import): call fn print
StykMartin 313b0ee
fix(pxemenu): use xmlrpc client,urllib, and configparser from six
StykMartin 9483957
fix(distro-import): use anonymous fn instead string::strip
StykMartin 40a936e
chore(distro-import): format code and sort imports
StykMartin 3919ba2
fix(distro-import): use is to compare None
StykMartin 8857893
fix(distro-import): simplify comparison
StykMartin 8df208e
chore(config): format code and sort imports
StykMartin 8d649ec
fix(concurrency): update exception syntax for Python 3 compatibility
StykMartin 1d2f31c
chore(concurrency): format code and sort imports
StykMartin daef1d6
chore(clear-netboot): format code and sort imports
StykMartin d1fce19
tests: use pytest w/ python3
StykMartin fa58bd9
fix(proxy): use absolute import to import utils
StykMartin 5069073
ci: run unit tests during pull requests
StykMartin c14e540
fix(provision): use datetime fn instead on using custom
StykMartin 75bef29
fix(common-helpers): always encode unicode to str
StykMartin 497f87b
fix(spec): add werkzeug to builddeps
StykMartin 964772c
fix(test): use file mode compatible with python six
StykMartin c0736c4
fix(test): always write bytes to test images
StykMartin 9cc592f
fix(test): drop deprecated fn names
StykMartin 12e8abc
fix(concurrency): wait till fileno is ready
StykMartin a06a82f
fix(concurrency): decode bytes
StykMartin b89bd27
test: extend test suite to validate concurrency
StykMartin 3ac3e93
fix(proxy-main): use pywsgi instead of deprecated wsgi
StykMartin 3fe496a
test: refactor _assert_process_group_is_removed to use psutil
StykMartin d83fbc9
ci: run init inside the container that forwards signals
StykMartin 359066a
ci: define timeout for unit and integration tests
StykMartin 4d08ee5
ci: run unit test on CentOS 9 Stream
StykMartin 491b538
ci: show python environment
StykMartin af764fe
chore: remove init.d configuration
StykMartin 0693013
Make source code cloneable on Windows
JohnVillalovos 0d8c870
chore: remove unused check_output
StykMartin f8262f1
fix(proxy): explicitly convert ascii_control_chars to list for Py3 co…
StykMartin 138a41d
fix(proxy): use raw string notation for ANSI escape code regex
StykMartin 1932974
fix: use warning instead of deprecated warn in logger
StykMartin 451e548
chore: noqa for broad exceptions in main loops
StykMartin 11d6660
refactor(watchdog): remove shadowing for variable greenlet
StykMartin f6e8b00
fix(watchdog): handle missing 'Running' task in recipe abort process
StykMartin 932c4aa
refactor(utils): remove unused code
StykMartin ab2bd02
refactor(test): rename 'id' to 'entity_id' to avoid shadowing built-i…
StykMartin 3c38986
refactor(proxy): always close hub
StykMartin 0ae7e70
docs: generate man page for beaker-import
StykMartin 7062f60
ci: execute unit tests on fedora
StykMartin 584f728
build: manage logrotate and log dir for py3 targets
StykMartin d84bcdd
refactor: use absolute import for utility bkr utility library
StykMartin 20896e9
fix(provision): encode power env fields on python 2
StykMartin File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
# Copyright Contributors to the Beaker project. | ||
# SPDX-License-Identifier: GPL-2.0-or-later | ||
|
||
import unittest | ||
|
||
import six | ||
|
||
from bkr.common.helpers import SensitiveUnicode | ||
from bkr.labcontroller.provision import build_power_env | ||
|
||
|
||
class TestBuildPowerEnv(unittest.TestCase): | ||
def test_build_power_env(self): | ||
t_command = { | ||
"power": { | ||
"address": u"192.168.1.1", | ||
"id": u"42", | ||
"user": u"root", | ||
"passwd": SensitiveUnicode(u"toor"), | ||
}, | ||
"action": u"reboot", | ||
} | ||
|
||
expected = { | ||
"power_address": "192.168.1.1", | ||
"power_id": "42", | ||
"power_user": "root", | ||
"power_pass": "toor", | ||
"power_mode": "reboot", | ||
} | ||
|
||
actual = build_power_env(t_command) | ||
|
||
for key, value in six.iteritems(expected): | ||
self.assertEqual(expected[key], actual[key]) | ||
|
||
def test_build_power_env_with_missing_fields(self): | ||
t_command = { | ||
"power": {"address": u"192.168.1.1", "passwd": SensitiveUnicode(u"toor")}, | ||
"action": u"reboot", | ||
} | ||
|
||
expected = { | ||
"power_address": "192.168.1.1", | ||
"power_id": "", | ||
"power_user": "", | ||
"power_pass": "toor", | ||
"power_mode": "reboot", | ||
} | ||
|
||
actual = build_power_env(t_command) | ||
|
||
for key, value in six.iteritems(expected): | ||
self.assertEqual(expected[key], actual[key]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice rewrite!