Skip to content

Commit

Permalink
Merge branch 'master' into setuptools
Browse files Browse the repository at this point in the history
  • Loading branch information
mboldt committed Oct 5, 2016
2 parents 4f56a9a + c1ea198 commit e40480c
Show file tree
Hide file tree
Showing 6 changed files with 45 additions and 52 deletions.
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,13 @@ The pipeline verifies that:
- The generated tile passes all acceptance tests in `ci/acceptance-tests`
- The generated tile successfully deploys to a current version of PCF
- The deployed tile passes all deployment tests in `ci/deployment-tests`

## Contributing to the Tile Generator

We welcome comments, questions, and contributions from community members. Please consider
the following ways to contribute:

- File Github issues for questions, bugs and new features and comment and vote on the ones that you are interested in.
- If you want to contribute code, please make your code changes on a fork of this repository and submit a
pull request to the master branch of tile-generator. We strongly suggest that you first file an issue to
let us know of your intent, or comment on the issue you are planning to address.
2 changes: 2 additions & 0 deletions sample/missing-properties.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ customer_name: Jimmy's Johnnys
street_address: Cartaway Alley
city: New Jersey
country: country_us
username: SpongeBob
password: { 'secret': SquarePants }
app2:
persistence_store_type: none # p-mysql # Works, but turned off because this is not deployed in our PCF environments
dynamic_service_plans:
Expand Down
21 changes: 21 additions & 0 deletions sample/tile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,19 @@ forms:
default: true
- name: country_elsewhere
label: Elsewhere
- name: account-info-1
label: Account Info
description: Example Account Information Form
properties:
- name: username
type: string
label: Username
constraints:
- must_match_regex: '^[^!@#$%^&*()]*$'
error_message: 'This name cannot contain capital digits.'
- name: password
type: secret
label: Password

service_plan_forms:
- name: custom_dynamic_service_plan_1
Expand All @@ -63,6 +76,10 @@ service_plan_forms:
type: integer
configurable: true
description: The number of available seats for this license
default: 1
constraints:
min: 1
max: 500
- name: custom_dynamic_service_plan_2
label: Custom Dynamic Service Plan 2
description: Custom Dynamic service plan 2 for Test Tile
Expand All @@ -79,7 +96,10 @@ service_plan_forms:
type: integer
configurable: true
description: The number of licenses
default: 1

# Deprecated but still supported for backward compatibility.
# Use service_plan_forms instead.
dynamic_service_plans:
- name: description
type: string
Expand All @@ -93,6 +113,7 @@ dynamic_service_plans:
type: integer
configurable: true
description: The number of available seats for this license
default: 1

packages:

Expand Down
7 changes: 6 additions & 1 deletion tile_generator/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,15 @@ def add_defaults(context):
properties = form.get('properties', [])
for property in properties:
if 'configurable' not in property:
property['configurable'] = 'true'
property['configurable'] = True
context['all_properties'] += properties
for property in context['all_properties']:
property['name'] = property['name'].lower().replace('-','_')
default = property.get('default', property.pop('value', None)) # NOTE this intentionally removes property['value']
if default is not None:
property['default'] = default
property['configurable'] = property.get('configurable', False)
property['optional'] = property.get('optional', False)

def default_stemcell(context):
stemcell_criteria = context.get('stemcell_criteria', {})
Expand Down
4 changes: 2 additions & 2 deletions tile_generator/templates/jobs/deploy-all.sh.erb
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ function import_opsmgr_variables() {
end
end
%>
export DYNAMIC_PLANS='<%= Shellwords.escape JSON.dump(plans) %>'
export DYNAMIC_PLANS=<%= Shellwords.escape JSON.dump(plans) %>
{% endif %}
{% for service_plan_form in context.service_plan_forms %}
<%
Expand All @@ -58,7 +58,7 @@ function import_opsmgr_variables() {
end
end
%>
export {{ service_plan_form.name | upper }}='<%= Shellwords.escape JSON.dump(plans) %>'
export {{ service_plan_form.name | upper }}=<%= Shellwords.escape JSON.dump(plans) %>
{% endfor %}

{% for property in context.all_properties %}
Expand Down
53 changes: 4 additions & 49 deletions tile_generator/templates/tile/metadata.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,17 +72,7 @@ property_blueprints:
type: string
configurable: true
{% for field in dynamic_service_plans %}
- name: {{ field.name }}
type: {{ field.type }}
configurable: {{ field.configurable }}
decription: {{ field.description }}
{% if field.options is defined %}
options:
{% for option in field.options %}
- name: {{ option.name }}
label: {{ option.label }}
{% endfor %}
{% endif %}
- {{ field | yaml | indent }}
{% endfor %}
{% endif %}
{% for service_plan_form in service_plan_forms %}
Expand All @@ -102,17 +92,7 @@ property_blueprints:
type: string
configurable: true
{% for field in service_plan_form.properties %}
- name: {{ field.name }}
type: {{ field.type }}
configurable: {{ field.configurable }}
decription: {{ field.description }}
{% if field.options is defined %}
options:
{% for option in field.options %}
- name: {{ option.name }}
label: {{ option.label }}
{% endfor %}
{% endif %}
- {{ field | yaml | indent }}
{% endfor %}
{% endfor %}

Expand Down Expand Up @@ -162,32 +142,7 @@ property_blueprints:
# Custom properties from the tile.yml file
#
{% for property in all_properties %}
- name: {{ property.name }} # Refer to this elsewhere as (( .properties.{{ property.name }} ))
type: {{ property.type }}
{% if property.value is defined %}
default: {{ property.value }}
{% elif property.default is defined %}
default: {{ property.default }}
{% endif %}
configurable: {{ property.configurable or 'false' }}
optional: {{ property.optional or 'false' }}
{% if property.constraints is defined %}
constraints:
{{ property.constraints | yaml | indent }}
{% endif %}
{% if property.options is defined %}
options:
{% for option in property.options %}
- name: {{ option.name }}
label: {{ option.label }}
{% if option.default is defined %}
default: {{ option.default }}
{% endif %}
{% if option.slug is defined %}
slug: {{ option.slug }}
{% endif %}
{% endfor %}
{% endif %}
- {{ property | yaml | indent(2) }}
{% endfor %}

form_types:
Expand All @@ -212,7 +167,7 @@ form_types:

{% for service_plan_form in service_plan_forms %}
#
# Custom Service Plan form {{ service_plan_form.name}} from the tile.yml file
# Custom Service Plan form {{service_plan_form.name}} from the tile.yml file
#
- name: {{ service_plan_form.name }}
label: {{ service_plan_form.label }}
Expand Down

0 comments on commit e40480c

Please sign in to comment.