Skip to content

Commit

Permalink
Merge bb8a077 into c45df5e
Browse files Browse the repository at this point in the history
  • Loading branch information
rambleraptor authored Sep 20, 2018
2 parents c45df5e + bb8a077 commit 4dddf4e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 11 deletions.
5 changes: 3 additions & 2 deletions templates/ansible/resource.erb
Original file line number Diff line number Diff line change
Expand Up @@ -406,13 +406,14 @@ def unwrap_resource(result, module):
<% end -%>
<%=
lines(method_decl('return_if_object', ['module', 'response',
('kind' if object.kind?)]))
('kind' if object.kind?),
'allow_not_found=False']))
-%>
<% if object.return_if_object -%>
<%= lines(indent(object.return_if_object, 4)) -%>
<% else # if object.return_if_object -%>
# If not found, return nothing.
if response.status_code == 404:
if allow_not_found and response.status_code == 404:
return None

# If no content, return nothing.
Expand Down
16 changes: 7 additions & 9 deletions templates/ansible/transport.erb
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,14 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-%>
<% if object.kind? -%>
def fetch_resource(module, link, kind):
<%=
method_decl('fetch_resource', ['module', 'link', ('kind' if object.kind?),
'allow_not_found=True'])
%>
auth = GcpSession(module, <%= quote_string(prod_name) -%>)
return return_if_object(module, auth.get(link), kind)
<% else # object.kind? -%>
def fetch_resource(module, link):
auth = GcpSession(module, <%= quote_string(prod_name) -%>)
return return_if_object(module, auth.get(link))

<% end # object.kind? -%>
return <%= method_call('return_if_object', ['module', 'auth.get(link)',
('kind' if object.kind?),
'allow_not_found']) %>

<% unless object.self_link_query.nil? -%>

Expand Down

0 comments on commit 4dddf4e

Please sign in to comment.