lib/puppet/provider/grafana_dashboard/grafana.rb
def find_dashboard
        if not self.dashboards.find{ |x| x['title'] == resource[:title] }
            return
        end

        response = self.send_request('GET', '/api/dashboards/db/%s' % self.slug)
        if response.code != '200'
            fail("Fail to retrieve dashboard '%s' (HTTP response: %s/%s)" %
                 [resource[:title], response.code, response.body])
        end

        begin
            # Cache the dashboard's content
            @dashboard = JSON.parse(response.body)["dashboard"]
        rescue JSON::ParserError
            fail("Fail to parse dashboard '%s': %s" %
                 [resource[:title], response.body])
        end
    end
# Return the dashboard matching with the resource's title
Return the dashboard matching with the resource's title
Return the dashboard matching with the resource ' s title
def find_dashboard
        if not self.dashboards.find{ |x| x['title'] == resource[:title] }
            return
        end
        response = self.send_request('GET', '/api/dashboards/db/%s' % self.slug)
        if response.code != '200'
            fail("Fail to retrieve dashboard '%s' (HTTP response: %s/%s)" %
                 [resource[:title], response.code, response.body])
        end
        begin
            @dashboard = JSON.parse(response.body)["dashboard"]
        rescue JSON::ParserError
            fail("Fail to parse dashboard '%s': %s" %
                 [resource[:title], response.body])
        end
    end
def find_dashboard if not self . dashboards . find { | x | x [ 'title' ] == resource [ :title ] } return end response = self . send_request ( 'GET' , '/api/dashboards/db/%s' % self . slug ) if response . code != '200' fail ( "Fail to retrieve dashboard '%s' (HTTP response: %s/%s)" % [ resource [ :title ] , response . code , response . body ] ) end begin @dashboard = JSON . parse ( response . body ) [ "dashboard" ] rescue JSON :: ParserError fail ( "Fail to parse dashboard '%s': %s" % [ resource [ :title ] , response . body ] ) end end
Return the dashboard matching with the resource's title
Return the dashboard matching with the resource ' s title
# Cache the dashboard's content