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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Alain Takoudjou
slapos
Commits
262e6629
Commit
262e6629
authored
Jan 25, 2017
by
Alain Takoudjou
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
sync: exit if instance is already synced
parent
0359eddb
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
9 additions
and
11 deletions
+9
-11
stack/sync/buildout.cfg
stack/sync/buildout.cfg
+2
-2
stack/sync/instance-sync.cfg.jinja2.in
stack/sync/instance-sync.cfg.jinja2.in
+2
-1
stack/sync/template/template-sync.sh.in
stack/sync/template/template-sync.sh.in
+5
-8
No files found.
stack/sync/buildout.cfg
View file @
262e6629
...
...
@@ -20,7 +20,7 @@ eggs +=
recipe = slapos.recipe.template:jinja2
template = ${:_profile_base_location_}/instance-sync.cfg.jinja2.in
rendered = ${buildout:directory}/template-sync.cfg
md5sum =
3158b940beb73226f5c974ab682f8f29
md5sum =
66cc114bd3e8cf1f8181297270508373
context =
key template_logrotate_base template-logrotate-base:rendered
raw certificate_request_bin ${buildout:directory}/bin/ca-web-request
...
...
@@ -62,7 +62,7 @@ filename = template-instance-clone.cfg.jinja2.in
[template-sync.sh]
<= template-sync-download-base
md5sum =
14db8beae2d1a027e8339d0879f32a90
md5sum =
ea5a2555e5fc9d271a55ca4e809c963d
filename = template-sync.sh.in
[prepare-sync-server.sh]
...
...
stack/sync/instance-sync.cfg.jinja2.in
View file @
262e6629
...
...
@@ -68,6 +68,7 @@ command-line = {{ certificate_request_bin }}
recipe = slapos.recipe.template:jinja2
template = {{ template_sync_sh }}
rendered = ${directory:bin}/instance-sync-raw
exit-complete-file = ${directory:var}/instance_sync_done
context =
key ca_certificate certificate-client-request:ca-cert
key client_base_dir buildout:directory
...
...
@@ -78,7 +79,7 @@ context =
raw bash_executable_location {{ bash_executable_location }}
raw curl_executable_location {{ curl_executable_location }}
raw client_identity_file ${openssh-client:public-key}
raw exit_completed_file ${
directory:srv}/.instance_sync_done
raw exit_completed_file ${
:exit-complete-file}
raw output_log_file ${logrotate-sync-client:log}
raw python_rsync_script {{ template_python_sync }}
raw rsync_executable_location {{ rsync_executable_location }}
...
...
stack/sync/template/template-sync.sh.in
View file @
262e6629
...
...
@@ -15,6 +15,11 @@ KNOWN_HOSTS_FILE={{ ssh_known_hosts_file }}
CLONE_DIR=$BASE_DIR/var/clone-op
mkdir -p $CLONE_DIR
if [ -s "{{ exit_completed_file }}" ]; then
echo "Instance was already synced. Existing..."
exit 0
fi
if [ -s "$CLONE_DIR/ID" ]; then
UNIQUE_KEY=$(cat $CLONE_DIR/ID)
else
...
...
@@ -27,14 +32,6 @@ READY_KEY=$UNIQUE_KEY"_ready"
DONE_KEY=$UNIQUE_KEY"_done"
INFO_KEY=$UNIQUE_KEY"_info"
# Reinitialise folder
#if [ -d "$CLONE_DIR" ]; then
# rm -rf $CLONE_DIR;
#fi
if [ -f "{{ exit_completed_file }}" ]; then
rm -f {{ exit_completed_file }};
fi
curl_client () {
# -w %{http_code}
{{ curl_executable_location }} -k -L --cert {{ client_certificate }} --key {{ client_key }} --cacert {{ ca_certificate }} $*
...
...
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