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
f760cbd7
Commit
f760cbd7
authored
Feb 13, 2011
by
John E. Vincent
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adding a catchall callback for each object type
parent
02fd3c92
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
36 additions
and
0 deletions
+36
-0
applications.rb
lib/noah/applications.rb
+9
-0
configurations.rb
lib/noah/configurations.rb
+9
-0
hosts.rb
lib/noah/hosts.rb
+9
-0
services.rb
lib/noah/services.rb
+9
-0
No files found.
lib/noah/applications.rb
View file @
f760cbd7
...
...
@@ -9,6 +9,9 @@ class Application < Ohm::Model
index
:name
after
:create
,
:notify_via_redis
after
:update
,
:notify_via_redis
def
validate
assert_present
:name
assert_unique
:name
...
...
@@ -37,6 +40,12 @@ class Application < Ohm::Model
end
end
end
protected
def
notify_via_redis
msg
=
self
.
to_hash
.
merge
({
:class
=>
self
.
class
})
Ohm
.
redis
.
publish
(
:noah
,
msg
.
to_json
)
end
end
class
Applications
...
...
lib/noah/configurations.rb
View file @
f760cbd7
...
...
@@ -14,6 +14,9 @@ class Configuration < Ohm::Model
index
:format
index
:body
after
:create
,
:notify_via_redis
after
:update
,
:notify_via_redis
def
validate
assert_present
:name
assert_present
:format
...
...
@@ -42,6 +45,12 @@ class Configuration < Ohm::Model
end
end
end
protected
def
notify_via_redis
msg
=
self
.
to_hash
.
merge
({
:class
=>
self
.
class
})
Ohm
.
redis
.
publish
(
:noah
,
msg
.
to_json
)
end
end
class
Configurations
...
...
lib/noah/hosts.rb
View file @
f760cbd7
...
...
@@ -11,6 +11,9 @@ class Host < Ohm::Model
index
:name
index
:status
after
:create
,
:notify_via_redis
after
:update
,
:notify_via_redis
def
validate
assert_present
:name
assert_present
:status
...
...
@@ -45,6 +48,12 @@ class Host < Ohm::Model
end
end
end
protected
def
notify_via_redis
msg
=
self
.
to_hash
.
merge
({
:class
=>
self
.
class
})
Ohm
.
redis
.
publish
(
:noah
,
msg
.
to_json
)
end
end
class
Hosts
...
...
lib/noah/services.rb
View file @
f760cbd7
...
...
@@ -11,6 +11,9 @@ class Service < Ohm::Model
index
:name
index
:status
after
:create
,
:notify_via_redis
after
:update
,
:notify_via_redis
def
validate
assert_present
:name
assert_present
:status
...
...
@@ -48,6 +51,12 @@ class Service < Ohm::Model
end
end
end
protected
def
notify_via_redis
msg
=
self
.
to_hash
.
merge
({
:class
=>
self
.
class
})
Ohm
.
redis
.
publish
(
:noah
,
msg
.
to_json
)
end
end
class
Services
...
...
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