Bug 1791095

Summary: Installation with python3-lib389 lib produces msg "BytesWarning: str() on a bytes instance"
Product: Red Hat Enterprise Linux 8 Reporter: mreynolds
Component: 389-ds-baseAssignee: mreynolds
Status: CLOSED ERRATA QA Contact: RHDS QE <ds-qe-bugs>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 8.0CC: lkrispen, pasik, spichugi, tbordaz, vashirov
Target Milestone: rcFlags: mreynolds: mirror+
Target Release: 8.2   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: 389-ds-1.4-8020020200120164339.bf00efc9 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-04-28 16:01:40 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description mreynolds 2020-01-14 20:17:03 UTC
This bug is created as a clone of upstream ticket:
https://pagure.io/389-ds-base/issue/50798

#### Issue Description

When installing FreeIPA server on fedora 31 with the python library, the following message is displayed:
```
...
  [1/44]: creating directory server instance
/usr/lib/python3.7/site-packages/lib389/instance/setup.py:786: BytesWarning: str() on a bytes instance
  self.log.debug(f"CMD: {' '.join(result.args)} ; STDOUT: {result.stdout} ; STDERR: {result.stderr}")
  [2/44]: configure autobind for root
...
```

Uninstallation also produces the same type of message:
```
...
Unconfiguring directory server
/usr/lib/python3.7/site-packages/lib389/instance/remove.py:105: BytesWarning: str() on a bytes instance
  _log.debug(f"CMD: {' '.join(result.args)} ; STDOUT: {result.stdout} ; STDERR: {result.stderr}")
Unconfiguring ipa-custodia

...
```
#### Package Version and Platform
389-ds-base-1.4.2.5-3.fc31.x86_64
freeipa-server-4.9.0.dev201912201432+git-0.fc31.x86_64 (from copr @freeipa/freeipa-master-nightly)

#### Steps to reproduce

1. ipa-server-install --domain $DOMAIN --realm $REALM -a Secret123 -p Secret123 -U
2. ipa-server-install --uninstall -U

### Proposed fix

In the file `lib389/instance/setup.py`, the line 786:
```
            self.log.debug(f"CMD: {' '.join(result.args)} ; STDOUT: {result.stdout} ; STDERR: {result.stderr}")
```
should use `result.stdout.decode('utf-8')` and `result.stderr.decode('utf-8')`

In the file `lib389/instance/remove.py` the line 105:
```
        _log.debug(f"CMD: {' '.join(result.args)} ; STDOUT: {result.stdout.decode()} ; STDERR: {result.stderr.decode()}")
```
should use `result.stdout.decode('utf-8')` and `result.stderr.decode('utf-8')`

Comment 4 errata-xmlrpc 2020-04-28 16:01:40 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2020:1703