Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
Noah
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
Noah
Commits
025b59ff
Commit
025b59ff
authored
Jun 08, 2011
by
John E. Vincent
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adding a RunDeck agent
parent
71a5b6fd
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
39 additions
and
0 deletions
+39
-0
agent.rb
lib/noah/agent.rb
+1
-0
rundeck_agent.rb
lib/noah/agents/rundeck_agent.rb
+38
-0
No files found.
lib/noah/agent.rb
View file @
025b59ff
...
...
@@ -4,6 +4,7 @@ require 'noah'
require
'noah/agents/http_agent'
require
'noah/agents/https_agent'
require
'noah/agents/dummy_agent'
require
'noah/agents/rundeck_agent'
begin
candidates
=
[]
Gem
.
source_index
.
find_all
{
|
g
|
candidates
<<
g
[
1
].
name
if
g
[
1
].
name
=~
/^noah-agents-.*/
}
...
...
lib/noah/agents/rundeck_agent.rb
0 → 100644
View file @
025b59ff
require
File
.
join
(
File
.
dirname
(
__FILE__
),
'base_agent'
)
require
'em-http/middleware/cookie_jar'
require
'uri'
module
Noah::Agents
class
RunDeckAgent
<
Base
PREFIX
=
"rundeck://"
NAME
=
self
.
class
.
to_s
DEFAULT_CONCURRENCY
=
50
def
work!
(
ep
,
message
)
logger
.
info
(
"Sending message to (
#{
ep
}
)"
)
uri
=
URI
.
parse
(
ep
)
credentials
=
{
:j_username
=>
uri
.
user
,
:j_password
=>
uri
.
password
}
EM
::
HttpRequest
.
use
EM
::
Middleware
::
CookieJar
conn
=
EM
::
HttpRequest
.
new
(
"http://
#{
uri
.
host
}
:
#{
uri
.
port
}
/j_security_check"
)
http
=
conn
.
post
:body
=>
credentials
http
.
callback
{
logger
.
info
(
"Logged in to RunDeck. Calling path"
)
conn2
=
EM
::
HttpRequest
.
new
(
"http://
#{
uri
.
host
}
:
#{
uri
.
port
}#{
uri
.
path
}
?
#{
uri
.
query
}
"
)
exec
=
conn2
.
get
exec
.
callback
{
logger
.
info
(
"Successfully called
#{
ep
}
"
)
logger
.
info
(
"Response from RunDeck:"
)
logger
.
info
(
"
#{
exec
.
response
}
"
)
}
exec
.
errback
{
logger
.
error
(
"Something went wrong with
#{
ep
}
"
)
}
}
http
.
errback
{
logger
.
error
(
"Something went wrong with
#{
ep
}
"
)
}
end
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment