Browse Source

Bugfix in slim + enhancement of mass_deploy

Now mass_deploy is able to stop when slim fails indicating on wich action slim fails
Bufixing webui conf edition
Yann Weber 8 years ago
parent
commit
747ff25ada
2 changed files with 18 additions and 8 deletions
  1. 14
    4
      progs/mass_deploy.sh
  2. 4
    4
      progs/slim/slim.py

+ 14
- 4
progs/mass_deploy.sh View File

19
 \t\t- purgedb is to remove all created mongodb db\n"
19
 \t\t- purgedb is to remove all created mongodb db\n"
20
 }
20
 }
21
 
21
 
22
+slim_fails() {
23
+	if [ -z "$1" ]
24
+	then
25
+		echo "SLIM fails for some reason. Abording..." >&2
26
+	else
27
+		echo "SLIM fails when $1. Abording...." >&2
28
+	fi
29
+	exit 1
30
+}
31
+
22
 test -f $conffile || badconf
32
 test -f $conffile || badconf
23
 #Load conffile
33
 #Load conffile
24
 . $conffile
34
 . $conffile
111
 for i in $(seq $ninstance)
121
 for i in $(seq $ninstance)
112
 do
122
 do
113
 	iname="${random_name}_$(printf "%05d" $i)"
123
 	iname="${random_name}_$(printf "%05d" $i)"
114
-	slim -n $iname -c
115
-	slim -n $iname -s --interface web --static-url 'http://127.0.0.1/static' --uwsgi-workers 2
116
-	slim -n $iname -m
124
+	slim -n $iname -c || slim_fails "creating instance"
125
+	slim -n $iname -s --interface web --static-url 'http://127.0.0.1/static' --uwsgi-workers 2 || slim_fails "configuring instancee"
126
+	slim -n $iname -m || slim_fails "running make in instance"
117
 
127
 
118
 	#Mongo db database creation
128
 	#Mongo db database creation
119
 	dbname="${MONGODB_DB_PREFIX}_$iname"
129
 	dbname="${MONGODB_DB_PREFIX}_$iname"
125
 exit
135
 exit
126
 EOF
136
 EOF
127
 	#Append created db to instance conf
137
 	#Append created db to instance conf
128
-	slim -n $iname -s --datasource_connectors mongodb --host localhost --user $dbuser --password $dbpass --db_name $dbname
138
+	slim -n $iname -s --datasource_connectors mongodb --host localhost --user $dbuser --password $dbpass --db_name $dbname || slim_fails "configuring the instance's datasource"
129
 
139
 
130
 done
140
 done
131
 
141
 

+ 4
- 4
progs/slim/slim.py View File

94
             config['lodel2.webui']['listen_address'] = str(args.listen_address)
94
             config['lodel2.webui']['listen_address'] = str(args.listen_address)
95
         if args.static_url is not None:
95
         if args.static_url is not None:
96
             config['lodel2.webui']['static_url'] = str(args.static_url)
96
             config['lodel2.webui']['static_url'] = str(args.static_url)
97
+        if args.uwsgi_workers is not None:
98
+            config['lodel2.webui']['uwsgi_workers'] = str(args.uwsgi_workers)
97
     else: #interface is python
99
     else: #interface is python
98
         if args.listen_port is not None or args.listen_address is not None:
100
         if args.listen_port is not None or args.listen_address is not None:
99
             logging.error("Listen port and listen address will not being set. \
101
             logging.error("Listen port and listen address will not being set. \
100
 Selected interface is not the web iterface")
102
 Selected interface is not the web iterface")
101
         if 'lodel.webui' in config:
103
         if 'lodel.webui' in config:
102
             del(config['lodel2.webui'])
104
             del(config['lodel2.webui'])
103
-        if args.uwsgi_workers is not None:
104
-            config['lodel2.webui']['uwsgi_workers'] = int(args.uwsgi_workers)
105
 
105
 
106
     if args.datasource_connectors is not None:
106
     if args.datasource_connectors is not None:
107
         darg = args.datasource_connectors
107
         darg = args.datasource_connectors
491
         help="Select the password name to connect the datasource")
491
         help="Select the password name to connect the datasource")
492
     confs.add_argument('--db_name', type=str,
492
     confs.add_argument('--db_name', type=str,
493
         help="Select the database name on which datasource will be connect")
493
         help="Select the database name on which datasource will be connect")
494
-    confs.add_argument('-p', '--uwsgi-workers', type=str, default='2',
495
-                       help="Number of workers to spawn at the start of uwsgi")
494
+    confs.add_argument('--uwsgi-workers', type=int, default='2',
495
+        metavar = 'N', help="Number of workers to spawn at the start of uwsgi")
496
     return parser
496
     return parser
497
 
497
 
498
 if __name__ == '__main__':
498
 if __name__ == '__main__':

Loading…
Cancel
Save