Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
CIRCLE
/
salt
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
17
Merge Requests
1
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
598f03ea
authored
Nov 17, 2014
by
Bach Dániel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
improve manager scripts
parent
ce6ccdf2
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
73 additions
and
12 deletions
+73
-12
salt/manager/configuration.sls
+10
-0
salt/manager/files/compile.sh
+17
-2
salt/manager/files/init.sh
+17
-0
salt/manager/files/syncdb.sh
+27
-10
salt/manager/virtualenv.sls
+2
-0
No files found.
salt/manager/configuration.sls
View file @
598f03ea
...
...
@@ -49,3 +49,13 @@ portal.conf:
- group: root
- template: jinja
- source: file:///home/{{ pillar['user'] }}/circle/miscellaneous/slowcelery.conf
salt://manager/files/init.sh:
cmd.script:
- template: jinja
- user: {{ pillar['user'] }}
- stateful: true
- require:
- virtualenv: virtualenv_manager
- file: /home/{{ pillar['user'] }}/.virtualenvs/circle/bin/postactivate
- user: {{ pillar['user'] }}
salt/manager/files/compile.sh
View file @
598f03ea
...
...
@@ -2,6 +2,21 @@
cd
/home/
{{
pillar[
'user'
]
}}
/circle/circle/
source
/home/
{{
pillar[
'user'
]
}}
/.virtualenvs/circle/bin/activate
source
/home/
{{
pillar[
'user'
]
}}
/.virtualenvs/circle/bin/postactivate
MANAGE
=
"python /home/{{ pillar['user'] }}/circle/circle/manage.py"
bower install
python /home/
{{
pillar[
'user'
]
}}
/circle/circle/manage.py collectstatic
--noinput
python /home/
{{
pillar[
'user'
]
}}
/circle/circle/manage.py compilemessages
COLLECTED
=
$(
$MANAGE
collectstatic
--noinput
|
awk
'/static files copied to/ {print $1}'
)
OLD_SHA
=
$(
sha1sum locale/hu/LC_MESSAGES/
*
.mo
)
$MANAGE
compilemessages
NEW_SHA
=
$(
sha1sum locale/hu/LC_MESSAGES/
*
.mo
)
echo
"
$COLLECTED
$NEW_SHA
$OLD_SHA
"
if
[
"
$NEW_SHA
"
!=
"
$OLD_SHA
"
-o
"
$COLLECTED
"
-ne
0
]
;
then
CHANGED
=
yes
else
CHANGED
=
no
fi
echo
"changed=
$CHANGED
comment='copied:
$COLLECTED
'"
salt/manager/files/init.sh
0 → 100644
View file @
598f03ea
#!/bin/bash
source
/home/
{{
pillar[
'user'
]
}}
/.virtualenvs/circle/bin/activate
source
/home/
{{
pillar[
'user'
]
}}
/.virtualenvs/circle/bin/postactivate
{
%
set
fw
=
pillar[
'fwdriver'
]
%
}
exec
python /home/
{{
pillar[
'user'
]
}}
/circle/circle/manage.py init
\
--portal-ip
={{
fw[
'portal_ip'
]
}}
\
--external-net
={{
fw[
'external_net'
]
}}
\
--management-net
={{
fw[
'management_net'
]
}}
\
--vm-net
={{
fw[
'vm_net'
]
}}
\
--admin-user
={{
pillar[
'admin_user'
]
}}
\
--admin-pass
={{
pillar[
'admin_pass'
]
}}
\
--datastore-queue
={{
pillar[
'storagedriver'
][
'queue_name'
]
}}
\
--firewall-queue
={{
fw[
'queue_name'
]
}}
\
--external-if
={{
fw[
'external_if'
]
}}
\
--management-if
={{
fw[
'management_if'
]
}}
\
--trunk-if
={{
fw[
'trunk_if'
]
}}
salt/manager/files/syncdb.sh
View file @
598f03ea
#!/bin/bash
sudo
stop manager
sudo
stop portal
source
/home/
{{
pillar[
'user'
]
}}
/.virtualenvs/circle/bin/activate
source
/home/
{{
pillar[
'user'
]
}}
/.virtualenvs/circle/bin/postactivate
python /home/
{{
pillar[
'user'
]
}}
/circle/circle/manage.py syncdb
--all
--noinput
python /home/
{{
pillar[
'user'
]
}}
/circle/circle/manage.py migrate acl
python /home/
{{
pillar[
'user'
]
}}
/circle/circle/manage.py migrate firewall
python /home/
{{
pillar[
'user'
]
}}
/circle/circle/manage.py migrate storage
python /home/
{{
pillar[
'user'
]
}}
/circle/circle/manage.py syncdb
--migrate
--noinput
python /home/
{{
pillar[
'user'
]
}}
/circle/circle/manage.py migrate vm
--merge
sudo
stop manager
>
/dev/null 2>&1
sudo
stop portal
>
/dev/null 2>&1
source
/home/
{{
pillar[
'user'
]
}}
/.virtualenvs/circle/bin/activate
>
/dev/null 2>&1
source
/home/
{{
pillar[
'user'
]
}}
/.virtualenvs/circle/bin/postactivate
>
/dev/null 2>&1
MANAGE
=
"python /home/{{ pillar['user'] }}/circle/circle/manage.py"
OUT
=
$(
(
$MANAGE
syncdb
--noinput
&&
$MANAGE
migrate acl
&&
$MANAGE
migrate firewall
&&
$MANAGE
migrate storage
&&
$MANAGE
syncdb
--migrate
--noinput
&&
$MANAGE
migrate vm
--merge
)
2>&1
)
if
[
$?
-ne
0
]
;
then
/usr/bin/python
-c
"import sys; import json; sys.stdout.write(json.dumps({'changed': False, 'comment': sys.stdin.read()}) + '
\n
')"
<<<
"
$OUT
"
exit
1
fi
COUNT
=
$(
/bin/egrep
"Migrating forwards to"
-c
<<<
"
$OUT
"
)
if
[
$?
-eq
0
]
;
then
CHANGED
=
yes
else
CHANGED
=
no
fi
echo
"changed=
$CHANGED
comment='Migrated:
$COUNT
'"
salt/manager/virtualenv.sls
View file @
598f03ea
...
...
@@ -15,6 +15,7 @@ salt://manager/files/syncdb.sh:
cmd.script:
- template: jinja
- user: {{ pillar['user'] }}
- stateful: true
- require:
- virtualenv: virtualenv_manager
- file: /home/{{ pillar['user'] }}/.virtualenvs/circle/bin/postactivate
...
...
@@ -24,6 +25,7 @@ salt://manager/files/compile.sh:
cmd.script:
- template: jinja
- user: {{ pillar['user'] }}
- stateful: true
- require:
- virtualenv: virtualenv_manager
- file: /home/{{ pillar['user'] }}/.virtualenvs/circle/bin/postactivate
...
...
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