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

Update for Foreman API 1.13, TLS and hostnames #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions src/foreman.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
# Configuration:
# FOREMAN_AUTH (e.g. user:password for Basic Auth)
# FOREMAN_URL (e.g. https://foreman.example.com)
# NODE_TLS_REJECT_UNAUTHORIZED - Should you need to connect to a self-signed Foreman
#
# Commands:
#
Expand All @@ -21,10 +22,10 @@ foreman_auth = process.env.FOREMAN_AUTH

module.exports = (robot) ->

robot.hear /foreman (s|search) (\w+)/i, (msg) ->
robot.hear /foreman (s|search) (\w+(\-\w+)*)/i, (msg) ->
foremansearch msg

robot.hear /foreman (c|classes) (\w+)/i, (msg) ->
robot.hear /foreman (c|classes) (\w+(\-\w+)*)/i, (msg) ->
foremanpuppetclasses msg

foremansearch = (msg, query, cb) ->
Expand All @@ -47,7 +48,7 @@ foremansearch = (msg, query, cb) ->
object = body["results"][i]
response += "#{i + 1}. #{object['name']} id: #{object['id']}\n"
response += "#{process.env.FOREMAN_URL}/hosts/#{object['name']}\n"
response += "#{process.env.FOREMAN_URL}/hosts/#{object['name']}/reports/last\n"
response += "#{process.env.FOREMAN_URL}/hosts/#{object['name']}/config_reports/last\n"
i++
msg.send response

Expand Down