~wallyworld/juju-core/fast-lxc-everywhere

« back to all changes in this revision

Viewing changes to provider/local/environ.go

  • Committer: Tarmac
  • Author(s): Ian Booth
  • Date: 2014-04-24 12:33:19 UTC
  • mfrom: (2664.1.4 constraints-vocab)
  • Revision ID: tarmac-20140424123319-iifvboa1kjuprj7l
[r=wallyworld] Support constraints vocabs

Add support to constraints validation for
vocabs for each attribute. eg arch and
instance-type can only have well defined
values for each provider. The vocab check
is part of constraints validation.

https://codereview.appspot.com/96730043/

Show diffs side-by-side

added added

removed removed

Lines of Context:
315
315
}
316
316
 
317
317
// ConstraintsValidator is defined on the Environs interface.
318
 
func (env *localEnviron) ConstraintsValidator() constraints.Validator {
 
318
func (env *localEnviron) ConstraintsValidator() (constraints.Validator, error) {
319
319
        validator := constraints.NewValidator()
320
320
        validator.RegisterUnsupported(unsupportedConstraints)
321
 
        return validator
 
321
        supportedArches, err := env.SupportedArchitectures()
 
322
        if err != nil {
 
323
                return nil, err
 
324
        }
 
325
        validator.RegisterVocabulary(constraints.Arch, supportedArches)
 
326
        return validator, nil
322
327
}
323
328
 
324
329
// StartInstance is specified in the InstanceBroker interface.