oracle: update schema and validation

This commit is contained in:
Tiago Ilieve 2016-02-19 20:14:37 -02:00
parent 12dbc6a07e
commit c07f56b796
2 changed files with 21 additions and 3 deletions

View file

@ -10,8 +10,16 @@ import tasks.packages
def validate_manifest(data, validator, error):
import os.path
schema_path = os.path.normpath(os.path.join(os.path.dirname(__file__), 'manifest-schema.yml'))
validator(data, schema_path)
validator(data, os.path.join(os.path.dirname(__file__), 'manifest-schema.yml'))
keys = ['username', 'password', 'identity-domain']
if 'credentials' in data['provider']:
if not all(key in data['provider']['credentials'] for key in keys):
msg = 'All Oracle Compute Cloud credentials should be specified in the manifest'
error(msg, ['provider', 'credentials'])
if not data['provider'].get('container'):
msg = 'The container to which the image will be uploaded should be specified'
error(msg, ['provider'])
def resolve_tasks(taskset, manifest):

View file

@ -3,6 +3,17 @@ $schema: http://json-schema.org/draft-04/schema#
title: Oracle manifest
type: object
properties:
provider:
type: object
properties:
credentials:
type: object
properties:
username: {type: string}
password: {type: string}
identity-domain: {type: string}
container: {type: string}
verify: {type: boolean}
system:
type: object
properties:
@ -21,7 +32,6 @@ properties:
type:
type: string
enum:
- none
- msdos
- gpt
required: [backing]