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:
...
@@ -49,3 +49,13 @@ portal.conf:
- group: root
- group: root
- template: jinja
- template: jinja
- source: file:///home/{{ pillar['user'] }}/circle/miscellaneous/slowcelery.conf
- 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 @@
...
@@ -2,6 +2,21 @@
cd
/home/
{{
pillar[
'user'
]
}}
/circle/circle/
cd
/home/
{{
pillar[
'user'
]
}}
/circle/circle/
source
/home/
{{
pillar[
'user'
]
}}
/.virtualenvs/circle/bin/activate
source
/home/
{{
pillar[
'user'
]
}}
/.virtualenvs/circle/bin/activate
source
/home/
{{
pillar[
'user'
]
}}
/.virtualenvs/circle/bin/postactivate
source
/home/
{{
pillar[
'user'
]
}}
/.virtualenvs/circle/bin/postactivate
MANAGE
=
"python /home/{{ pillar['user'] }}/circle/circle/manage.py"
bower install
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
#!/bin/bash
sudo
stop manager
sudo
stop portal
sudo
stop manager
>
/dev/null 2>&1
source
/home/
{{
pillar[
'user'
]
}}
/.virtualenvs/circle/bin/activate
sudo
stop portal
>
/dev/null 2>&1
source
/home/
{{
pillar[
'user'
]
}}
/.virtualenvs/circle/bin/postactivate
source
/home/
{{
pillar[
'user'
]
}}
/.virtualenvs/circle/bin/activate
>
/dev/null 2>&1
python /home/
{{
pillar[
'user'
]
}}
/circle/circle/manage.py syncdb
--all
--noinput
source
/home/
{{
pillar[
'user'
]
}}
/.virtualenvs/circle/bin/postactivate
>
/dev/null 2>&1
python /home/
{{
pillar[
'user'
]
}}
/circle/circle/manage.py migrate acl
MANAGE
=
"python /home/{{ pillar['user'] }}/circle/circle/manage.py"
python /home/
{{
pillar[
'user'
]
}}
/circle/circle/manage.py migrate firewall
python /home/
{{
pillar[
'user'
]
}}
/circle/circle/manage.py migrate storage
OUT
=
$(
(
$MANAGE
syncdb
--noinput
&&
python /home/
{{
pillar[
'user'
]
}}
/circle/circle/manage.py syncdb
--migrate
--noinput
$MANAGE
migrate acl
&&
python /home/
{{
pillar[
'user'
]
}}
/circle/circle/manage.py migrate vm
--merge
$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:
...
@@ -15,6 +15,7 @@ salt://manager/files/syncdb.sh:
cmd.script:
cmd.script:
- template: jinja
- template: jinja
- user: {{ pillar['user'] }}
- user: {{ pillar['user'] }}
- stateful: true
- require:
- require:
- virtualenv: virtualenv_manager
- virtualenv: virtualenv_manager
- file: /home/{{ pillar['user'] }}/.virtualenvs/circle/bin/postactivate
- file: /home/{{ pillar['user'] }}/.virtualenvs/circle/bin/postactivate
...
@@ -24,6 +25,7 @@ salt://manager/files/compile.sh:
...
@@ -24,6 +25,7 @@ salt://manager/files/compile.sh:
cmd.script:
cmd.script:
- template: jinja
- template: jinja
- user: {{ pillar['user'] }}
- user: {{ pillar['user'] }}
- stateful: true
- require:
- require:
- virtualenv: virtualenv_manager
- virtualenv: virtualenv_manager
- file: /home/{{ pillar['user'] }}/.virtualenvs/circle/bin/postactivate
- 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