Error 100: Unable to render instance groups for deployment. Errors are: - Unable to render jobs for instance group 'mongodb_gateway'. Errors are: - Unable to render templates for job 'mongodb_gateway'. Errors are: - Error filling in template 'mongodb_gateway.yml.erb' (line 5: undefined method `acls' for nil:NilClass)


Alex Irazabal
 

Here is the file in question: why does it fail for gateway.acls?
---
<%
service = "mongodb"
gateway = eval("properties.#{service}_gateway")
acls = gateway.acls
plan_enabled = properties.service_plans && properties.service_plans.send(service.to_sym)
plan_mgmt = plan_enabled && properties.service_plans.send(service.to_sym)
supported_plans = properties.supported_plans
if supported_plans
plan_mgmt.instance_eval("def fields; @table.keys.select { |v| #{supported_plans}.include? v.to_s }; end;") if plan_mgmt
else
plan_mgmt.instance_eval("def fields; @table.keys; end;") if plan_mgmt
end
supported_versions = gateway.supported_versions
version_aliases = gateway.version_aliases
version_aliases.instance_eval("def fields; @table.keys; end;") if version_aliases
nats_props_name = properties.nats_props || "nats"
nats_props = properties.send(nats_props_name)
nats = "nats://#{nats_props.user}:#{nats_props.password}@#{nats_props.address}:#{nats_props.port}"
lifecycle = properties.service_lifecycle
cc_api_version = gateway.cc_api_version || "v1"
unique_id = "8f4af9f9-0f29-4957-87a3-1039ce983ede"
%>
mbus: <%= nats %>
index: <%= spec.index %>

cloud_controller_uri: <%= properties.cc.srv_api_uri %>

service:
name: mongodb
unique_id: <%= unique_id %>
version: "1.8"
description: 'MongoDB NoSQL database'
provider: core
provider_name: 'Core'
plans:
<% if plan_enabled %>
<% for plan in plan_mgmt.fields.each %>
<% plan_description = plan_mgmt.send(plan.to_sym).description || "#{plan} plan" %>
<% plan_free_flag = plan_mgmt.send(plan.to_sym).free %>
<%= "'#{plan}':" %>
description: <%= "'#{plan_description}'" %>
unique_id: "<%= plan %>-<%= unique_id %>"
extra: ''
free: <%= !plan_free_flag.nil? && plan_free_flag.to_s || "true" %>
<% end %>
<% else %>
"free":
description: "free plan"
free: true
<% end %>
default_plan: '<%= gateway.default_plan || 'free' %>'
cf_plan_id:
<% plan_mgmt.fields.each do |pf| %>
<%= "'#{pf}': #{plan_mgmt.send(pf).configuration.cf_plan_id}" %>
<% end if plan_mgmt %>
tags: ['nosql', 'document', 'mongodb']
timeout: <%= properties.mongodb_gateway.service_timeout || 10 %>
<% if acls %>
<% if acls.is_a? String %>
acls: <%= acls %>
<% else %>
<% acls.plans.instance_eval("def fields; @table.keys; end;") if acls && acls.plans %>
acls:
<%= "users: ['#{acls.users.join("', '")}']" if acls.users %>
<%= "wildcards: ['#{acls.wildcards.join("', '")}']" if acls.wildcards %>
<% if acls.plans %>
plans:
<% acls.plans.fields.each do |plan|%>
<%= "#{plan}:"%>
<%= "users: ['#{acls.plans.send(plan.to_sym).users.join("', '")}']" if acls.plans.send(plan.to_sym).users %>
<%= "wildcards: ['#{acls.plans.send(plan.to_sym).wildcards.join("', '")}']" if acls.plans.send(plan.to_sym).wildcards %>
<% end %>
<% end %>
<% end %>
<% end %>
supported_versions: <%= "['#{supported_versions.join("' , '")}']" %>
<% if version_aliases && !version_aliases.fields.empty? %>
version_aliases:
<% for version_alias in version_aliases.fields.each %>
<%= "'#{version_alias}': '#{version_aliases.send(version_alias.to_sym)}'" %>
<% end %>
<% end %>

<% if gateway.ip_route %>
ip_route: <%= gateway.ip_route %>
<% end %>

cc_api_version: <%= cc_api_version %>

<% if cc_api_version == "v2" %>
gateway_name: "MongoDB (Core) Gateway"
uaa_client_id: <%= properties.uaa_client_id || "vmc" %>
uaa_endpoint: <%= properties.uaa_endpoint %>
uaa_client_auth_credentials:
username: <%= properties.uaa_client_auth_credentials.username %>
password: "<%= properties.uaa_client_auth_credentials.password %>"
service_auth_tokens:
mongodb_core: "<%= gateway.token %>"
<% end %>

token: "<%= gateway.token %>"
logging:
file: /var/vcap/sys/log/mongodb_gateway/mongodb_gateway.log
level: debug
<% if properties.syslog_aggregator %>
syslog: vcap.mongodb_gateway
<% end %>

pid: /var/vcap/sys/run/mongodb_gateway/mongodb_gateway.pid
node_timeout: <%= gateway.node_timeout || 8 %>
z_interval: <%= gateway.z_interval || 30 %>
check_orphan_interval: <%= gateway.check_orphan_interval || -1 %>
double_check_orphan_interval: <%= gateway.double_check_orphan_interval || 300 %>
max_nats_payload: <%= nats_props.max_payload || 1048576 %>

<% if lifecycle and lifecycle.resque %>
resque:
host: <%= lifecycle.resque.host %>
port: <%= lifecycle.resque.port %>
password: "<%= lifecycle.resque.password %>"
expire: <%= lifecycle.resque.expire %>
download_url_template: "http://<%= lifecycle.download_url %>/serialized/%{service}/%{name}/snapshots/%{snapshot_id}?token=%{token}"
<% end %>

<% if plan_enabled %>
plan_management:
plans:
<% plan_mgmt.fields.each do |pf| %>
'<%= pf %>':
high_water: <%= plan_mgmt.send(pf).job_management.high_water %>
low_water: <%= plan_mgmt.send(pf).job_management.low_water %>
allow_over_provisioning: <%= plan_mgmt.send(pf).configuration.allow_over_provisioning || "false" %>
<% opts = plan_mgmt.send(pf).configuration.lifecycle %>
<% if opts && opts.enable == true %>
lifecycle:
serialization: <%= opts.serialization || "disable" %>
<% if opts.snapshot %>
snapshot:
quota: <%= opts.snapshot.quota || 0 %>
<% end %>
<% if opts.serialization || opts.snapshot %>
job: enable
<% end %>
<% end %>
<% end %>
<% end %>

Join cf-dev@lists.cloudfoundry.org to automatically receive all group messages.