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

USERNAME KeyError when private Hipchat server is set #364

Open
phiro69 opened this issue Jun 12, 2018 · 6 comments
Open

USERNAME KeyError when private Hipchat server is set #364

phiro69 opened this issue Jun 12, 2018 · 6 comments
Labels

Comments

@phiro69
Copy link

phiro69 commented Jun 12, 2018

I'm going through the quickstart and ran into some trouble, I've isolated it down to when I add the WILL_HIPCHAT_SERVER (we run a private, internal hipchat server) env variable to my will.sh script:

<snip>
export WILL_HIPCHAT_SERVER=hipchat.ourcompany.com
export [email protected]
python run_will.py

This results in the following:

$ ./will.sh 
Traceback (most recent call last):
  File "run_will.py", line 2, in <module>
    from will.main import WillBot
  File "/home/me/willbot/lib/python3.6/site-packages/will/main.py", line 28, in <module>
    from will import settings
  File "/home/me/willbot/lib/python3.6/site-packages/will/settings.py", line 432, in <module>
    import_settings()
  File "/home/me/willbot/lib/python3.6/site-packages/will/settings.py", line 79, in import_settings
    format(user=settings["USERNAME"].split("@")[0],
KeyError: 'USERNAME'
$

Any ideas what I'm doing wrong? Is Python 3.6 OK to use?

@phiro69
Copy link
Author

phiro69 commented Jun 12, 2018

Also, for both python 2.7 and python 3.6, following the quickstart guide, when I configure it for just hipchat and no other backend (no slack, no rocketchat, no console), it puts the # on the wrong side of the quotes on the config.py, like this:

# Platforms and mediums messages can come in and go out on.
IO_BACKENDS = [
    "# will.backends.io_adapters.slack",
    "will.backends.io_adapters.hipchat",
    "# will.backends.io_adapters.rocketchat",
    "# will.backends.io_adapters.shell",
]

Which results in extra errors on startup :(

@skoczen
Copy link
Owner

skoczen commented Jun 13, 2018

@phiro69 thanks for the report - the latter bug will be fixed in the next release!

As for your first bug - yep, python 3.6 is fine - the problem is a missing setting. You'll need to set a WILL_USERNAME as well for private hipchat instances. Typically, this stuff is caught by the interactive startup script, but it looks like there are some snags in private hipchat. I don't run one, so haven't been able to test it!

As you get it sorted, if you're up for putting together a PR that would make this easier for other folks, it'd be happily accepted!

@phiro69
Copy link
Author

phiro69 commented Jun 13, 2018

Thanks, adding WILL_USERNAME and repeating the WILL_HIPCHAT_USERNAME value got me past that, and there's no errors. However, it seems to stall after Scheduler Started, and never gets to "Chat Client Started". There's no cpu usage, and I can't find logs/syslog has no relevant entries. Any ideas where I can see where it's hanging/what it's waiting on?

Bootstrapping complete.

Starting core processes:
  ✓ IO: HipChat Backend started.
  ✓ Analysis: NoAnalysis Backend started.
  ✓ Analysis: HistoryAnalysis Backend started.
  ✓ Generation: FuzzyAllMatchesBackend Backend started.
  ✓ Generation: RegexBackend Backend started.
  ✓ Execution: BestScoreBackend Backend started.
  ✓ Web server started at http://something.com:8000.
  ✓ Scheduler started.

@phiro69
Copy link
Author

phiro69 commented Jun 13, 2018

Found the debug settings in config.py, it's having issues getting to the jabber/xmpp id address. Picking at this...

@phiro69
Copy link
Author

phiro69 commented Jun 13, 2018

That was the issue, our private server may show your jabber id as @chat.btf.hipchat.com, but I was able to set it to @ourdomain.com and it was able to connect. It responded to a @name hi, so I should it down and I'm going to start molding Will to my nefarious needs ;)

What issue exactly were you inviting me to fix with a pr? The #'s on the inside of the quotes, or?

@wontonst
Copy link
Collaborator

@phiro69 I think what @skoczen meant is a better error than KeyError: 'USERNAME' since on non-private servers the interactive startup is better about letting the developer know what's wrong.

that said, if you don't have any further comments, I think we can close this issue due to #378

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants