Skip to content

Commit

Permalink
Merge branch 'master' into usermetadata
Browse files Browse the repository at this point in the history
  • Loading branch information
tomkukral authored Dec 19, 2017
2 parents 155f0a3 + cabcb83 commit 9a3331c
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 22 deletions.
1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
recursive-include kqueen/blueprints/ *.html
include kqueen/config/default_policy.json
5 changes: 4 additions & 1 deletion kqueen/blueprints/api/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,13 +216,16 @@ def provisioner_engine_list():
module = import_module(module_path)
_class = getattr(module, engine)
parameters = _class.get_parameter_schema()
name = '.'.join([module_path, engine])
engine_cls.append({
'name': '.'.join([module_path, engine]),
'name': name,
'verbose_name': getattr(_class, 'verbose_name', name),
'parameters': parameters
})
except NotImplementedError:
engine_cls.append({
'name': engine,
'verbose_name': engine,
'parameters': {
'provisioner': {},
'cluster': {}
Expand Down
37 changes: 22 additions & 15 deletions kqueen/engines/gce.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ class GceEngine(BaseEngine):
"""
name = 'gce'
verbose_name = 'Google Container engine'
# project = 'kqueen-186209'
# TODO: only subset of possible choices for zone is listed in parameter_schema,
# we could add more later, here is the list of possible choices:
# https://cloud.google.com/compute/docs/regions-zones/
Expand All @@ -33,14 +32,34 @@ class GceEngine(BaseEngine):
'type': 'json_file',
'label': 'Service Account File (JSON)',
'validators': {
'required': True
'required': True,
'jsonfile': [
'private_key_id',
'private_key',
'client_email',
'client_id',
'auth_uri',
'token_uri'
]
}
},
'project': {
'type': 'text',
'label': 'Project',
'validators': {
'required': True
'required': True,
}
}
},
'cluster': {
'node_count': {
'type': 'integer',
'label': 'Node Count',
'default': 1,
'validators': {
'required': True,
'min': 1,
'number': True
}
},
'zone': {
Expand All @@ -58,18 +77,6 @@ class GceEngine(BaseEngine):
'required': True
}
}
},
'cluster': {
'node_count': {
'type': 'integer',
'label': 'Node Count',
'default': 1,
'validators': {
'required': True,
'min': 1,
'number': True
}
}
}
}

Expand Down
7 changes: 2 additions & 5 deletions kqueen/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,7 @@ def apply(self, resource_text):
class Provisioner(Model, metaclass=ModelMeta):
id = IdField(required=True)
name = StringField(required=True)
verbose_name = StringField(required=False)
engine = StringField(required=True)
state = StringField()
parameters = JSONField()
Expand All @@ -312,10 +313,6 @@ def get_engine_cls(self):
_class = None
return _class

@property
def engine_name(self):
return getattr(self.get_engine_cls(), 'verbose_name', self.engine)

def engine_status(self, save=True):
state = config.get('PROVISIONER_UNKNOWN_STATE')
engine_class = self.get_engine_cls()
Expand All @@ -333,7 +330,7 @@ def alive(self):
def save(self, check_status=True):
if check_status:
self.state = self.engine_status(save=False)

self.verbose_name = getattr(self.get_engine_cls(), 'verbose_name', self.engine)
return super(Provisioner, self).save()


Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from setuptools import setup, find_packages

version = '0.12'
version = '0.13'

with open('README.rst') as f:
long_description = ''.join(f.readlines())
Expand Down

0 comments on commit 9a3331c

Please sign in to comment.