linkedin / linkedin/oncall

TypeError when executing user_sync.py via python3

Open
#319 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
1.3k
Forks
245
PR merge metrics
No merged PRs in 30d

Description

## Issue
Executing the LDAP [`user_sync.py`](https://github.com/linkedin/oncall/blob/master/src/oncall/bin/user_sync.py) script via `python@3.6.9` results in the following error:
`TypeError: a bytes-like object is required, not 'str'` (full output shown [here](https://gist.github.com/dk0r/9d17ae5e4531ee54ec2f986a6c3b846d))

## Expected Behavior
As described [here](https://oncall.tools/docs/admin_guide.html#adding-users), it is expected that the [`user_sync.py`](https://github.com/linkedin/oncall/blob/master/src/oncall/user_sync/ldap_sync.py) script should periodically sync users from a preexisting LDAP server

## Steps to reproduce
Migrate [`oncall@1.2.3`](https://github.com/linkedin/oncall/tree/v1.2.3) to python3.
Step-by-step instructions for getting oncall running via py3 are published [here](https://gist.github.com/dk0r/844c8284aea8dee6a3fe9f44ff91e875
)

## Troubleshooting attempts:
* I'm not a python dev but google indicates the above error may be due to an upstream issue w/ `gevent` running on py3.
Apparently something in `gevent` may need to be encoded to a bytes object via `.encode('utf-8')` 🤷🏻‍♂️
* Posted issue to irisoncall's [gitter](https://gitter.im/irisoncall/Lobby?at=5f441ba9ddc2d041c0c4d757)

@diegocepedaw @dwang159

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with src/oncall/bin/user_sync.py and src/oncall/user_sync/ldap_sync.py, then reproduce the failure under Python 3.6.9 using the linked migration instructions and traceback. The issue is done when the LDAP user sync runs under Python 3 without the reported TypeError.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.