Python3 fixes
Change-Id: I64669dad15ea2c83fec5cf317e7f5c030068b409
(cherry picked from commit b9214c2507
)
This commit is contained in:
parent
9ec79f7de8
commit
173da89b52
@ -13,6 +13,8 @@
|
||||
# limitations under the License.
|
||||
|
||||
"""Starter script for the Cloudpulse API service."""
|
||||
import eventlet
|
||||
eventlet.monkey_patch()
|
||||
|
||||
import logging as std_logging
|
||||
import os
|
||||
|
@ -57,7 +57,10 @@ class Cpulse(base.CloudpulsePersistentObject, base.CloudpulseObject,
|
||||
def _from_db_object(test, db):
|
||||
"""Converts a database entity to a formal object."""
|
||||
for field in test.fields:
|
||||
test[field] = db[field]
|
||||
if isinstance(db[field], bytes):
|
||||
test[field] = db[field].decode('utf-8')
|
||||
else:
|
||||
test[field] = db[field]
|
||||
|
||||
test.obj_reset_changes()
|
||||
return test
|
||||
|
@ -98,8 +98,8 @@ def execute(command):
|
||||
return {'status': 126, 'output': ""}
|
||||
|
||||
if p.returncode == 126 or p.returncode == 127:
|
||||
stdout = str(b"")
|
||||
return {'status': p.returncode, 'output': stdout}
|
||||
stdout = b''
|
||||
return {'status': p.returncode, 'output': stdout.decode('utf-8')}
|
||||
|
||||
|
||||
def get_container_name(name):
|
||||
|
Loading…
Reference in New Issue
Block a user