[
https://issues.apache.org/jira/browse/AIRFLOW-3868?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16764993#comment-16764993
]
ASF GitHub Bot commented on AIRFLOW-3868:
-----------------------------------------
eladkal commented on pull request #4689: [AIRFLOW-3868] - Incorrect import of
distutils in JenkinsHook
URL: https://github.com/apache/airflow/pull/4689
Make sure you have checked _all_ steps below.
### Jira
- [V] My PR addresses the following [Airflow
Jira](https://issues.apache.org/jira/browse/AIRFLOW-3868) issues and references
them in the PR title. For example, "\[AIRFLOW-XXX\] My Airflow PR"
- https://issues.apache.org/jira/browse/AIRFLOW-3868
### Description
Fix error AttributeError: module 'distutils' has no attribute 'util'
**Before:**
```
Python 3.6.7
>>> import distutils
>>> print (distutils.util.strtobool('true'))
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: module 'distutils' has no attribute 'util'
>>>
```
**After:**
```
Python 3.6.7
>>> from distutils.util import strtobool
>>> print (strtobool('true'))
1
```
### Code Quality
- [V] Passes `flake8`
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
> Incorrect import of distutils in JenkinsHook
> --------------------------------------------
>
> Key: AIRFLOW-3868
> URL: https://issues.apache.org/jira/browse/AIRFLOW-3868
> Project: Apache Airflow
> Issue Type: Bug
> Components: hooks
> Affects Versions: 1.10.2
> Reporter: Nathan Hadfield
> Assignee: Elad
> Priority: Major
> Labels: easy-fix, hooks
>
> When trying to run a task based upon the JenkinsJobTriggerOperator, the
> following error is returned.
> [2019-02-11 12:37:30,746] \{{models.py:1788}} ERROR - module 'distutils' has
> no attribute 'util'
> Traceback (most recent call last):
> File "/usr/local/lib/python3.6/site-packages/airflow/models.py", line 1657,
> in _run_raw_task
> result = task_copy.execute(context=context)
> File
> "/usr/local/lib/python3.6/site-packages/airflow/contrib/operators/jenkins_job_trigger_operator.py",
> line 211, in execute
> jenkins_server = self.get_hook().get_jenkins_server()
> File
> "/usr/local/lib/python3.6/site-packages/airflow/contrib/operators/jenkins_job_trigger_operator.py",
> line 192, in get_hook
> return JenkinsHook(self.jenkins_connection_id)
> File
> "/usr/local/lib/python3.6/site-packages/airflow/contrib/hooks/jenkins_hook.py",
> line 41, in __init__
> if distutils.util.strtobool(connection.extra):
> AttributeError: module 'distutils' has no attribute 'util'
> This seems to be related to the import of distutils in JenkinsHook.
>
>
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)