fix deployment bug and add databag templates
Change-Id: I070a3ee788e2f39814265533ed96332a2d8bed78
This commit is contained in:
parent
a431d34202
commit
5cecfac510
@ -77,9 +77,9 @@ class ChefInstaller(PKInstaller):
|
||||
|
||||
return chef_api
|
||||
|
||||
def get_env_name(self, dist_sys_name, cluster_id):
|
||||
def get_env_name(self, dist_sys_name, cluster_name):
|
||||
"""Generate environment name."""
|
||||
return "-".join((dist_sys_name, cluster_id))
|
||||
return "-".join((dist_sys_name, cluster_name))
|
||||
|
||||
def get_databag_name(self):
|
||||
"""Get databag name."""
|
||||
@ -162,8 +162,9 @@ class ChefInstaller(PKInstaller):
|
||||
|
||||
run_list = node.run_list
|
||||
for role in roles:
|
||||
if role not in run_list:
|
||||
node.run_list.append('role[%s]' % role)
|
||||
node_role = 'role[%s]' % role
|
||||
if node_role not in run_list:
|
||||
node.run_list.append(node_role)
|
||||
|
||||
node.save()
|
||||
logging.debug('Runlist for node %s is %s', node.name, node.run_list)
|
||||
@ -326,7 +327,8 @@ class ChefInstaller(PKInstaller):
|
||||
"""
|
||||
adapter_name = self.config_manager.get_adapter_name()
|
||||
cluster_id = self.config_manager.get_cluster_id()
|
||||
env_name = self.get_env_name(adapter_name, str(cluster_id))
|
||||
cluster_name = self.config_manager.get_clustername()
|
||||
env_name = self.get_env_name(adapter_name, cluster_name)
|
||||
|
||||
global_vars_dict = self._get_cluster_tmpl_vars()
|
||||
# Update environment
|
||||
@ -349,7 +351,7 @@ class ChefInstaller(PKInstaller):
|
||||
# set each host deployed config
|
||||
tmp = self.config_manager.get_host_deployed_package_config(host_id)
|
||||
tmp[const.TMPL_VARS_DICT] = vars_dict
|
||||
hosts_deployed_configs[host_id] = tmp
|
||||
hosts_deployed_configs[host_id][const.DEPLOYED_PK_CONFIG] = tmp
|
||||
|
||||
# set cluster deployed config
|
||||
cl_config = self.config_manager.get_cluster_deployed_package_config()
|
||||
|
9
compass/static/css/bootstrap.min.css
vendored
9
compass/static/css/bootstrap.min.css
vendored
File diff suppressed because one or more lines are too long
Binary file not shown.
Before Width: | Height: | Size: 8.6 KiB |
Binary file not shown.
Before Width: | Height: | Size: 12 KiB |
6
compass/static/js/bootstrap.min.js
vendored
6
compass/static/js/bootstrap.min.js
vendored
File diff suppressed because one or more lines are too long
2
compass/static/js/jquery-1.8.3.min.js
vendored
2
compass/static/js/jquery-1.8.3.min.js
vendored
File diff suppressed because one or more lines are too long
@ -1,10 +0,0 @@
|
||||
{% extends 'layout.jinja' %}
|
||||
|
||||
{% block title %}403 Forbidden{% endblock %}
|
||||
{% block content %}
|
||||
<h1>403 Forbidden</h1>
|
||||
<p class=text-error>
|
||||
Access to this page is forbidden for user
|
||||
<strong>{{ current_user.email }}</strong>.
|
||||
</p>
|
||||
{% endblock %}
|
@ -1,12 +0,0 @@
|
||||
{% extends 'layout.jinja' %}
|
||||
|
||||
{% block title %}Main Page{% endblock %}
|
||||
{% block content %}
|
||||
<p>
|
||||
{% if current_user.is_anonymous() %}
|
||||
You are not logged in.
|
||||
{% else %}
|
||||
Hi, <strong>{{ current_user.email }}</strong>!
|
||||
{% endif %}
|
||||
</p>
|
||||
{% endblock %}
|
@ -1,39 +0,0 @@
|
||||
<!doctype html>
|
||||
|
||||
<meta charset=utf-8>
|
||||
<title>{% block title %}{% endblock %}</title>
|
||||
<link rel=stylesheet media=screen href="{{ url_for('static', filename='css/bootstrap.min.css') }}">
|
||||
|
||||
<div class=container>
|
||||
<div class=navbar>
|
||||
<div class=navbar-inner>
|
||||
<span class=brand>Flask-Login example</span>
|
||||
<ul class=nav>
|
||||
{% for endpoint in [
|
||||
'index',
|
||||
'restricted',
|
||||
'login' if current_user.is_anonymous() else 'logout',
|
||||
] %}
|
||||
<li {% if endpoint == request.endpoint %}class=active{% endif %}>
|
||||
<a href="{{ url_for(endpoint) }}">{{ endpoint.capitalize() }}</a>
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
{% with messages = get_flashed_messages(with_categories=True) %}
|
||||
{% if messages %}
|
||||
{% for category, message in messages %}
|
||||
<div class="alert{{ ' alert-%s' % category if category != 'message' else '' }}">
|
||||
<button type=button class=close data-dismiss="alert">×</button>
|
||||
{{ message }}
|
||||
</div>
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
{% endwith %}
|
||||
{% block content %}
|
||||
{% endblock %}
|
||||
</div>
|
||||
|
||||
<script src="{{ url_for('static', filename='js/jquery-1.8.3.min.js') }}"></script>
|
||||
<script src="{{ url_for('static', filename='js/bootstrap.min.js') }}"></script>
|
@ -1,19 +0,0 @@
|
||||
{% extends 'layout.jinja' %}
|
||||
{% from 'macros.jinja' import with_errors %}
|
||||
|
||||
{% block title %}Login{% endblock %}
|
||||
{% block content %}
|
||||
<form class=form-horizontal action="{{ url_for('login', next=request.args.get('next')) }}" method=post>
|
||||
{{ form.hidden_tag() }}
|
||||
{{ with_errors(form.email, placeholder='Email') }}
|
||||
{{ with_errors(form.password, placeholder='Password') }}
|
||||
<div class=control-group>
|
||||
<div class=controls>
|
||||
<label class=checkbox>
|
||||
<input type=checkbox name=remember> Remember me
|
||||
</label>
|
||||
<button type=submit class="btn btn-primary">Login</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
{% endblock %}
|
@ -1,13 +0,0 @@
|
||||
{% macro with_errors(field) -%}
|
||||
<div class="control-group{% if field.errors %} error{% endif %}">
|
||||
{{ field.label(class_='control-label') }}
|
||||
<div class=controls>
|
||||
{{ field(**kwargs) }}
|
||||
{% if field.errors %}
|
||||
{% for error in field.errors %}
|
||||
<span class=text-error>{{ error }}</span>
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
{%- endmacro %}
|
@ -1,9 +0,0 @@
|
||||
{% extends 'layout.jinja' %}
|
||||
|
||||
{% block title %}Restricted Area{% endblock %}
|
||||
{% block content %}
|
||||
<h1>Restricted Area</h1>
|
||||
<p class=text-warning>
|
||||
This is restricted area!
|
||||
</p>
|
||||
{% endblock %}
|
@ -40,7 +40,9 @@ adapter_test_config = {
|
||||
"settings": {
|
||||
"chef_url": "https://127.0.0.1",
|
||||
"key_dir": "xxx",
|
||||
"client_name": "xxx"
|
||||
"client_name": "xxx",
|
||||
"databags": ["user_passwords", "db_passwords", "service_passwords",
|
||||
"secrets"]
|
||||
}
|
||||
},
|
||||
"metadata": {
|
||||
|
@ -0,0 +1,22 @@
|
||||
#set aval_services = ['nova', 'horizon', 'keystone', 'glance', 'ceilometer', 'neutron', 'cinder', 'heat', 'dash']
|
||||
#set config = $cluster.deployed_package_config
|
||||
#set service_config = {}
|
||||
#if "service_credentials" in $config:
|
||||
#set service_config = $cluster.deployed_package_config.service_credentials
|
||||
#end if
|
||||
#set databagitems = {}
|
||||
#if service_config:
|
||||
#for $service, $value in $service_config.iteritems():
|
||||
#if $service in $aval_services:
|
||||
#set databagitems[$service] = {$value.username: $value.password}
|
||||
#end if
|
||||
#end for
|
||||
|
||||
#else:
|
||||
#for $service in $aval_services:
|
||||
#set databagitems[$service] = {$service: $service}
|
||||
#end for
|
||||
#end if
|
||||
#import simplejson as json
|
||||
#set output = json.dumps($databagitems, encoding='utf-8')
|
||||
$output
|
@ -0,0 +1,8 @@
|
||||
{
|
||||
"openstack_identity_bootstrap_token": {
|
||||
"openstack_identity_bootstrap_token": "mytoken"
|
||||
},
|
||||
"neutron_metadata_secret": {
|
||||
"neutron_metadata_secret": "secret"
|
||||
}
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
#set required_services = ['openstack-image', 'openstack-compute', 'openstack-block-storage', 'openstack-orchestration', 'openstack-network', 'rbd']
|
||||
#set config = $cluster.deployed_package_config
|
||||
#set services_config = {}
|
||||
#if "services_credentials" in $config:
|
||||
#set services_config = $cluster.deployed_package_config.services_credentials
|
||||
#end if
|
||||
#set databagitems = {}
|
||||
#if services_config:
|
||||
#for $service, $value in $services_config.iteritems():
|
||||
#set databagitems[$service] = {$value.username: $value.password}
|
||||
#end for
|
||||
#end if
|
||||
#for $service in $required_services:
|
||||
#if $service not in $databagitems:
|
||||
#set databagitems[$service] = {$service: $service}
|
||||
#end if
|
||||
#end for
|
||||
#import simplejson as json
|
||||
#set output = json.dumps($databagitems, encoding='utf-8')
|
||||
$output
|
@ -0,0 +1,20 @@
|
||||
#set required_users = ['admin']
|
||||
#set config = $cluster.deployed_package_config
|
||||
#set user_config = {}
|
||||
#if "users_credentials" in $config:
|
||||
#set user_config = $cluster.deployed_package_config.users_credentials
|
||||
#end if
|
||||
#set databagitems = {}
|
||||
#if user_config:
|
||||
#for $user, $value in $user_config.iteritems():
|
||||
#set databagitems[$user] = {$value.username: $value.password}
|
||||
#end for
|
||||
#end if
|
||||
#for $user in $required_users:
|
||||
#if $user not in $databagitems:
|
||||
#set databagitems[$user] = {$user: $user}
|
||||
#end if
|
||||
#end for
|
||||
#import simplejson as json
|
||||
#set output = json.dumps($databagitems, encoding='utf-8')
|
||||
$output
|
@ -2,4 +2,7 @@ NAME = 'chef_installer'
|
||||
INSTANCE_NAME = 'chef_installer'
|
||||
SETTINGS = {
|
||||
'chef_url': 'https://$chef_ip',
|
||||
'key_dir': '',
|
||||
'client_name': '',
|
||||
'databags': ['user_passwords', 'db_passwords', 'service_passwords', 'secrets']
|
||||
}
|
||||
|
@ -18,7 +18,7 @@ sudo cp -rf $COMPASSDIR/bin/compass /usr/bin/
|
||||
sudo cp -rf $COMPASSDIR/bin/chef/* /opt/compass/bin/
|
||||
sudo cp -rf $WEB_HOME/public/* /var/www/compass_web/
|
||||
sudo cp -rf $WEB_HOME/v2 /var/www/compass_web/
|
||||
|
||||
sudo cp -rf $COMPASSDIR/templates /etc/compass/
|
||||
# add apache user to the group of virtualenv user
|
||||
sudo usermod -a -G `groups $USER|awk '{print$3}'` apache
|
||||
sudo chkconfig compass-progress-updated on
|
||||
|
@ -1,11 +1,22 @@
|
||||
{
|
||||
"nova": {
|
||||
"nova": "mypass"
|
||||
},
|
||||
"horizon": {
|
||||
"horizon": "horizon"
|
||||
},
|
||||
"keystone": {
|
||||
|
||||
}
|
||||
}
|
||||
#set aval_services = ['nova', 'horizon', 'keystone', 'glance', 'ceilometer', 'neutron', 'cinder', 'heat', 'dash']
|
||||
#set config = $cluster.deployed_package_config
|
||||
#set service_config = {}
|
||||
#if "service_credentials" in $config:
|
||||
#set service_config = $cluster.deployed_package_config.service_credentials
|
||||
#end if
|
||||
#set databagitems = {}
|
||||
#if service_config:
|
||||
#for $service, $value in $service_config.iteritems():
|
||||
#if $service in $aval_services:
|
||||
#set databagitems[$service] = {$value.username: $value.password}
|
||||
#end if
|
||||
#end for
|
||||
|
||||
#else:
|
||||
#for $service in $aval_services:
|
||||
#set databagitems[$service] = {$service: $service}
|
||||
#end for
|
||||
#end if
|
||||
#import simplejson as json
|
||||
#set output = json.dumps($databagitems, encoding='utf-8')
|
||||
$output
|
||||
|
@ -0,0 +1,8 @@
|
||||
{
|
||||
"openstack_identity_bootstrap_token": {
|
||||
"openstack_identity_bootstrap_token": "mytoken"
|
||||
},
|
||||
"neutron_metadata_secret": {
|
||||
"neutron_metadata_secret": "secret"
|
||||
}
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
#set required_services = ['openstack-image', 'openstack-compute', 'openstack-block-storage', 'openstack-orchestration', 'openstack-network', 'rbd']
|
||||
#set config = $cluster.deployed_package_config
|
||||
#set services_config = {}
|
||||
#if "services_credentials" in $config:
|
||||
#set services_config = $cluster.deployed_package_config.services_credentials
|
||||
#end if
|
||||
#set databagitems = {}
|
||||
#if services_config:
|
||||
#for $service, $value in $services_config.iteritems():
|
||||
#set databagitems[$service] = {$value.username: $value.password}
|
||||
#end for
|
||||
#end if
|
||||
#for $service in $required_services:
|
||||
#if $service not in $databagitems:
|
||||
#set databagitems[$service] = {$service: $service}
|
||||
#end if
|
||||
#end for
|
||||
#import simplejson as json
|
||||
#set output = json.dumps($databagitems, encoding='utf-8')
|
||||
$output
|
@ -0,0 +1,20 @@
|
||||
#set required_users = ['admin']
|
||||
#set config = $cluster.deployed_package_config
|
||||
#set user_config = {}
|
||||
#if "users_credentials" in $config:
|
||||
#set user_config = $cluster.deployed_package_config.users_credentials
|
||||
#end if
|
||||
#set databagitems = {}
|
||||
#if user_config:
|
||||
#for $user, $value in $user_config.iteritems():
|
||||
#set databagitems[$user] = {$value.username: $value.password}
|
||||
#end for
|
||||
#end if
|
||||
#for $user in $required_users:
|
||||
#if $user not in $databagitems:
|
||||
#set databagitems[$user] = {$user: $user}
|
||||
#end if
|
||||
#end for
|
||||
#import simplejson as json
|
||||
#set output = json.dumps($databagitems, encoding='utf-8')
|
||||
$output
|
Loading…
Reference in New Issue
Block a user