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
Show 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
def
dbinfo
begin
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
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
rescue
rescue
StandardError
=>
e
Rails
.
logger
.
warn
"Error retrieving dbinfo for
#{
@url
}
: [
#{
e
}
]"
return
nil
end
# if the site exists but is not a nilm...
required_keys
=
%w(size other free reserved)
unless
info
.
respond_to?
(
:has_key?
)
&&
required_keys
.
all?
{
|
s
|
info
.
key?
s
}
Rails
.
logger
.
warn
"Error
#{
@url
}
is not a Joule node"
return
nil
end
{
...
...
@@ -47,7 +55,8 @@ module Joule
begin
resp
=
self
.
class
.
get
(
"
#{
@url
}
/streams.json"
)
return
nil
unless
resp
.
success?
rescue
rescue
StandardError
=>
e
Rails
.
logger
.
warn
"Error retrieving db_schema for
#{
@url
}
: [
#{
e
}
]"
return
nil
end
resp
.
parsed_response
.
deep_symbolize_keys
...
...
@@ -61,11 +70,16 @@ module Joule
# if the site exists but is not a joule server...
required_keys
=
%w(name inputs outputs)
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
}
Rails
.
logger
.
warn
"Error
#{
@url
}
is not a Joule node"
return
nil
end
item
.
symbolize_keys!
end
rescue
rescue
StandardError
=>
e
Rails
.
logger
.
warn
"Error retrieving module_schemas for
#{
@url
}
: [
#{
e
}
]"
return
nil
end
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