Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
wattsworth
/
lumen-api
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
1765b262
authored
Jul 30, 2019
by
source_reader
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
added logging to joule backend errors
parent
e78b62d0
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
6 deletions
app/adapters/joule/backend.rb
app/adapters/joule/backend.rb
View file @
1765b262
...
@@ -20,19 +20,27 @@ module Joule
...
@@ -20,19 +20,27 @@ module Joule
def
dbinfo
def
dbinfo
begin
begin
resp
=
self
.
class
.
get
(
"
#{
@url
}
/version"
)
resp
=
self
.
class
.
get
(
"
#{
@url
}
/version"
)
return
nil
unless
resp
.
success?
if
not
resp
.
success?
Rails
.
logger
.
warn
"Error retrieving /version for
#{
@url
}
: [
#{
resp
.
body
}
]"
return
nil
end
version
=
resp
.
parsed_response
version
=
resp
.
parsed_response
resp
=
self
.
class
.
get
(
"
#{
@url
}
/dbinfo"
)
resp
=
self
.
class
.
get
(
"
#{
@url
}
/dbinfo"
)
return
nil
unless
resp
.
success?
if
not
resp
.
success?
Rails
.
logger
.
warn
"Error retrieving /dbinfo for
#{
@url
}
: [
#{
resp
.
body
}
]"
return
nil
end
info
=
resp
.
parsed_response
info
=
resp
.
parsed_response
rescue
rescue
StandardError
=>
e
Rails
.
logger
.
warn
"Error retrieving dbinfo for
#{
@url
}
: [
#{
e
}
]"
return
nil
return
nil
end
end
# if the site exists but is not a nilm...
# if the site exists but is not a nilm...
required_keys
=
%w(size other free reserved)
required_keys
=
%w(size other free reserved)
unless
info
.
respond_to?
(
:has_key?
)
&&
unless
info
.
respond_to?
(
:has_key?
)
&&
required_keys
.
all?
{
|
s
|
info
.
key?
s
}
required_keys
.
all?
{
|
s
|
info
.
key?
s
}
Rails
.
logger
.
warn
"Error
#{
@url
}
is not a Joule node"
return
nil
return
nil
end
end
{
{
...
@@ -47,7 +55,8 @@ module Joule
...
@@ -47,7 +55,8 @@ module Joule
begin
begin
resp
=
self
.
class
.
get
(
"
#{
@url
}
/streams.json"
)
resp
=
self
.
class
.
get
(
"
#{
@url
}
/streams.json"
)
return
nil
unless
resp
.
success?
return
nil
unless
resp
.
success?
rescue
rescue
StandardError
=>
e
Rails
.
logger
.
warn
"Error retrieving db_schema for
#{
@url
}
: [
#{
e
}
]"
return
nil
return
nil
end
end
resp
.
parsed_response
.
deep_symbolize_keys
resp
.
parsed_response
.
deep_symbolize_keys
...
@@ -61,11 +70,16 @@ module Joule
...
@@ -61,11 +70,16 @@ module Joule
# if the site exists but is not a joule server...
# if the site exists but is not a joule server...
required_keys
=
%w(name inputs outputs)
required_keys
=
%w(name inputs outputs)
items
.
each
do
|
item
|
items
.
each
do
|
item
|
return
nil
unless
item
.
respond_to?
(
:has_key?
)
&&
unless
item
.
respond_to?
(
:has_key?
)
&&
required_keys
.
all?
{
|
s
|
item
.
key?
s
}
required_keys
.
all?
{
|
s
|
item
.
key?
s
}
Rails
.
logger
.
warn
"Error
#{
@url
}
is not a Joule node"
return
nil
end
item
.
symbolize_keys!
item
.
symbolize_keys!
end
end
rescue
rescue
StandardError
=>
e
Rails
.
logger
.
warn
"Error retrieving module_schemas for
#{
@url
}
: [
#{
e
}
]"
return
nil
return
nil
end
end
items
items
...
...
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