Skip to content
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

IRC module not working properly with Python3 and SSL enabled #42256

Closed
zeten30 opened this issue Jul 3, 2018 · 2 comments · Fixed by #42267
Closed

IRC module not working properly with Python3 and SSL enabled #42256

zeten30 opened this issue Jul 3, 2018 · 2 comments · Fixed by #42267
Labels
affects_2.6 This issue/PR affects Ansible v2.6 bug This issue/PR relates to a bug. has_pr This issue has an associated PR. module This issue/PR relates to a module. python3 support:community This issue/PR relates to code supported by the Ansible community. traceback This issue/PR includes a traceback.

Comments

@zeten30
Copy link
Contributor

zeten30 commented Jul 3, 2018

SUMMARY

irc module fails
"unable to send to IRC: a bytes-like object is required, not 'str'

ISSUE TYPE
  • Bug Report
COMPONENT NAME

module IRC
/usr/lib/python3.6/site-packages/ansible/modules/notification/irc.py

ANSIBLE VERSION
# ansible-3 --version
ansible-3 2.6.0
  config file = /home/brq/mzink/Projects/RH/rhgs/ansible/ansible.cfg
  configured module search path = ['/home/brq/mzink/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3.6/site-packages/ansible
  executable location = /usr/bin/ansible-3
  python version = 3.6.5 (default, Mar 29 2018, 18:20:46) [GCC 8.0.1 20180317 (Red Hat 8.0.1-0.19)]
CONFIGURATION
ANSIBLE_PIPELINING(./ansible.cfg) = True
ANSIBLE_SSH_ARGS(./ansible.cfg) = -o ControlPersist=30m -q
ANSIBLE_SSH_CONTROL_PATH(./ansible.cfg) = ~/.ssh/ansible-mux-%%r@%%h:%%p
DEFAULT_FORKS(./ansible.cfg) = 24
DEFAULT_REMOTE_USER(./ansible.cfg) = root
DEFAULT_SCP_IF_SSH(./ansible.cfg) = True
DEFAULT_TIMEOUT(./ansible.cfg) = 30
DISPLAY_SKIPPED_HOSTS(./ansible.cfg) = False
HOST_KEY_CHECKING(./ansible.cfg) = False
INVENTORY_IGNORE_EXTS(./ansible.cfg) = ['.yaml', 'data', 'volumes', 'nodes']
RETRY_FILES_ENABLED(./ansible.cfg) = False
RETRY_FILES_SAVE_PATH(./ansible.cfg) = /home/brq/mzink/.ansible/retry-files
OS / ENVIRONMENT
> uname -a
Linux windmill 4.17.3-200.fc28.x86_64 #1 SMP Tue Jun 26 14:17:07 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
> cat /etc/fedora-release 
Fedora release 28 (Twenty Eight)

STEPS TO REPRODUCE
    "invocation": {
        "module_args": {
            "channel": "#chan",
            "color": "teal",
            "key": null,
            "msg": "some msg goes here",
            "nick": "ansibot",
            "nick_to": null,
            "part": false,
            "passwd": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
            "port": 6697,
            "server": "irc.server.com",
            "style": "none",
            "timeout": 30,
            "topic": null,
            "use_ssl": true
        }
    }
EXPECTED RESULTS

Working module

ACTUAL RESULTS
The full traceback is:
Traceback (most recent call last):
  File "/tmp/ansible_rg5fkxk0/ansible_module_irc.py", line 287, in main
    send_msg(msg, server, port, channel, nick_to, key, topic, nick, color, passwd, timeout, use_ssl, part, style)
  File "/tmp/ansible_rg5fkxk0/ansible_module_irc.py", line 189, in send_msg
    irc.send('PASS %s\r\n' % passwd)
  File "/usr/lib64/python3.6/ssl.py", line 897, in send
    return self._sslobj.write(data)
  File "/usr/lib64/python3.6/ssl.py", line 598, in write
    return self._sslobj.write(data)
TypeError: a bytes-like object is required, not 'str'

Works fine with python 2.7.

@ansibot
Copy link
Contributor

ansibot commented Jul 3, 2018

Files identified in the description:

If these files are inaccurate, please update the component name section of the description or use the !component bot command.

click here for bot help

@ansibot
Copy link
Contributor

ansibot commented Jul 3, 2018

@ansibot ansibot added affects_2.6 This issue/PR affects Ansible v2.6 bug This issue/PR relates to a bug. module This issue/PR relates to a module. needs_triage Needs a first human triage before being processed. python3 support:community This issue/PR relates to code supported by the Ansible community. traceback This issue/PR includes a traceback. labels Jul 3, 2018
@zeten30 zeten30 changed the title IRC module not working properly with Python3 and SSL enbled IRC module not working properly with Python3 and SSL enabled Jul 3, 2018
@ryansb ryansb removed the needs_triage Needs a first human triage before being processed. label Jul 3, 2018
bcoca added a commit to bcoca/ansible that referenced this issue Jul 3, 2018
@sivel sivel added the has_pr This issue has an associated PR. label Jul 8, 2018
bcoca added a commit to bcoca/ansible that referenced this issue Jul 10, 2018
* fix irc module to work with py3

fixes ansible#42256
@ansible ansible locked and limited conversation to collaborators Jul 10, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
affects_2.6 This issue/PR affects Ansible v2.6 bug This issue/PR relates to a bug. has_pr This issue has an associated PR. module This issue/PR relates to a module. python3 support:community This issue/PR relates to code supported by the Ansible community. traceback This issue/PR includes a traceback.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants