Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
slapos
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Thomas Leymonerie
slapos
Commits
81e0fa0f
Commit
81e0fa0f
authored
Jun 24, 2014
by
Cédric Le Ninivin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
apache-frontend: fix read of JSON file to not override current JSON
parent
9a6e913d
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
2 deletions
+7
-2
software/apache-frontend/instance-apache-replicate.cfg.in
software/apache-frontend/instance-apache-replicate.cfg.in
+6
-2
software/apache-frontend/instance.cfg
software/apache-frontend/instance.cfg
+1
-0
No files found.
software/apache-frontend/instance-apache-replicate.cfg.in
View file @
81e0fa0f
...
...
@@ -77,7 +77,11 @@ sla-{{ parameter }} = {{ slapparameter_dict.pop( sla_key + parameter ) }}
{% set slave_test_list = [] %}
{% set slave_configuration_path = slave_list_parameter.get('configuration-path') %}
{% set slave_configuration_json = builtin.open(slave_configuration_path, 'w+').read() %}
{% if os.path.exists(slave_configuration_path) %}
{% set slave_configuration_json = builtin.open(slave_configuration_path, 'r').read() %}
{% else %}
{% set slave_configuration_json = '' %}
{% endif %}
{% if slave_configuration_json == '' %}
{% set slave_configuration = {} %}
{% else %}
...
...
@@ -86,7 +90,7 @@ sla-{{ parameter }} = {{ slapparameter_dict.pop( sla_key + parameter ) }}
{% for slave in slave_instance_list %}
{% set slave_reference = slave.get('slave_reference') %}
## Update slave information if slave is new or have changed
{% if slave_
configuration.has_key(slave_reference)
%}
{% if slave_
reference in slave_configuration
%}
{% if slave.get('timestamp') != slave_configuration.get(slave_reference).get('timestamp') %}
{% do slave_configuration.get(slave_reference).__setitem__('timestamp', slave.get('timestamp')) %}
{% do slave_configuration.get(slave_reference).__setitem__('configuration', slave) %}
...
...
software/apache-frontend/instance.cfg
View file @
81e0fa0f
...
...
@@ -46,6 +46,7 @@ filename = instance-apache-replicate.cfg
extensions = jinja2.ext.do
extra-context =
import builtin __builtin__
import os os
key root_directory buildout:directory
section slave_list_parameter slave-list-parameter
raw template_publish_slave_information ${template-replicate-publish-slave-information:target}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment