Advertisement
Guest User

Untitled

a guest
Apr 20th, 2015
225
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 12.05 KB | None | 0 0
  1. diff --git a/functions-common b/functions-common
  2. index 24a462a..1b29824 100644
  3. --- a/functions-common
  4. +++ b/functions-common
  5. @@ -621,10 +621,10 @@ function install_default_policy {
  6. local sample_policy_dir="${project_dir}/etc/${project}/policy.d"
  7.  
  8. # first copy any policy.json
  9. - cp -p $sample_conf_dir/policy.json $conf_dir
  10. + sudo cp -p $sample_conf_dir/policy.json $conf_dir
  11. # then optionally copy over policy.d
  12. if [[ -d $sample_policy_dir ]]; then
  13. - cp -r $sample_policy_dir $conf_dir/policy.d
  14. + sudo cp -r $sample_policy_dir $conf_dir/policy.d
  15. fi
  16. }
  17.  
  18. @@ -1235,6 +1235,9 @@ function screen_process {
  19. SERVICE_DIR=${SERVICE_DIR:-${DEST}/status}
  20. USE_SCREEN=$(trueorfalse True USE_SCREEN)
  21.  
  22. + # Append the process to the screen rc file
  23. + screen_rc "$name" "$command"
  24. +
  25. screen -S $SCREEN_NAME -X screen -t $name
  26.  
  27. local real_logfile="${LOGDIR}/${name}.log.${CURRENT_LOG_TIME}"
  28. @@ -1274,10 +1277,6 @@ function screen_process {
  29. if [[ -n "$group" ]]; then
  30. command="sg $group '$command'"
  31. fi
  32. -
  33. - # Append the process to the screen rc file
  34. - screen_rc "$name" "$command"
  35. -
  36. screen -S $SCREEN_NAME -p $name -X stuff "$command & echo \$! >$SERVICE_DIR/$SCREEN_NAME/${name}.pid; fg || echo \"$name failed to start\" | tee \"$SERVICE_DIR/$SCREEN_NAME/${name}.failure\"$NL"
  37. }
  38.  
  39. @@ -1828,7 +1827,7 @@ function cidr2netmask {
  40. # cp_it source destination
  41. function cp_it {
  42. if [ -e $1 ] || [ -d $1 ]; then
  43. - cp -pRL $1 $2
  44. + sudo cp -pRL $1 $2
  45. fi
  46. }
  47.  
  48. diff --git a/inc/ini-config b/inc/ini-config
  49. index 26401f3..18313cf 100644
  50. --- a/inc/ini-config
  51. +++ b/inc/ini-config
  52. @@ -38,7 +38,7 @@ function inicomment {
  53. local section=$2
  54. local option=$3
  55.  
  56. - sed -i -e "/^\[$section\]/,/^\[.*\]/ s|^\($option[ \t]*=.*$\)|#\1|" "$file"
  57. + sudo sed -i -e "/^\[$section\]/,/^\[.*\]/ s|^\($option[ \t]*=.*$\)|#\1|" "$file"
  58. $xtrace
  59. }
  60.  
  61. @@ -52,7 +52,7 @@ function iniget {
  62. local option=$3
  63. local line
  64.  
  65. - line=$(sed -ne "/^\[$section\]/,/^\[.*\]/ { /^$option[ \t]*=/ p; }" "$file")
  66. + line=$(sudo sed -ne "/^\[$section\]/,/^\[.*\]/ { /^$option[ \t]*=/ p; }" "$file")
  67. echo ${line#*=}
  68. $xtrace
  69. }
  70. @@ -67,7 +67,7 @@ function iniget_multiline {
  71. local option=$3
  72. local values
  73.  
  74. - values=$(sed -ne "/^\[$section\]/,/^\[.*\]/ { s/^$option[ \t]*=[ \t]*//gp; }" "$file")
  75. + values=$(sudo sed -ne "/^\[$section\]/,/^\[.*\]/ { s/^$option[ \t]*=[ \t]*//gp; }" "$file")
  76. echo ${values}
  77. $xtrace
  78. }
  79. @@ -82,7 +82,7 @@ function ini_has_option {
  80. local option=$3
  81. local line
  82.  
  83. - line=$(sed -ne "/^\[$section\]/,/^\[.*\]/ { /^$option[ \t]*=/ p; }" "$file")
  84. + line=$(sudo sed -ne "/^\[$section\]/,/^\[.*\]/ { /^$option[ \t]*=/ p; }" "$file")
  85. $xtrace
  86. [ -n "$line" ]
  87. }
  88. @@ -107,7 +107,7 @@ function iniadd_literal {
  89. [[ -z $section || -z $option ]] && return
  90.  
  91. # Add it
  92. - sed -i -e "/^\[$section\]/ a\\
  93. + sudo sed -i -e "/^\[$section\]/ a\\
  94. $option = $value
  95. " "$file"
  96.  
  97. @@ -126,7 +126,7 @@ function inidelete {
  98. [[ -z $section || -z $option ]] && return
  99.  
  100. # Remove old values
  101. - sed -i -e "/^\[$section\]/,/^\[.*\]/ { /^$option[ \t]*=/ d; }" "$file"
  102. + sudo sed -i -e "/^\[$section\]/,/^\[.*\]/ { /^$option[ \t]*=/ d; }" "$file"
  103.  
  104. $xtrace
  105. }
  106. @@ -143,19 +143,19 @@ function iniset {
  107.  
  108. [[ -z $section || -z $option ]] && return
  109.  
  110. - if ! grep -q "^\[$section\]" "$file" 2>/dev/null; then
  111. + if ! sudo grep -q "^\[$section\]" "$file" 2>/dev/null; then
  112. # Add section at the end
  113. - echo -e "\n[$section]" >>"$file"
  114. + echo -e "\n[$section]" | sudo tee --append "$file"
  115. fi
  116. if ! ini_has_option "$file" "$section" "$option"; then
  117. # Add it
  118. - sed -i -e "/^\[$section\]/ a\\
  119. + sudo sed -i -e "/^\[$section\]/ a\\
  120. $option = $value
  121. " "$file"
  122. else
  123. local sep=$(echo -ne "\x01")
  124. # Replace it
  125. - sed -i -e '/^\['${section}'\]/,/^\[.*\]/ s'${sep}'^\('${option}'[ \t]*=[ \t]*\).*$'${sep}'\1'"${value}"${sep} "$file"
  126. + sudo sed -i -e '/^\['${section}'\]/,/^\[.*\]/ s'${sep}'^\('${option}'[ \t]*=[ \t]*\).*$'${sep}'\1'"${value}"${sep} "$file"
  127. fi
  128. $xtrace
  129. }
  130. @@ -182,11 +182,11 @@ function iniset_multiline {
  131. echo -e "\n[$section]" >>"$file"
  132. else
  133. # Remove old values
  134. - sed -i -e "/^\[$section\]/,/^\[.*\]/ { /^$option[ \t]*=/ d; }" "$file"
  135. + sudo sed -i -e "/^\[$section\]/,/^\[.*\]/ { /^$option[ \t]*=/ d; }" "$file"
  136. fi
  137. # Add new ones
  138. for v in $values; do
  139. - sed -i -e "/^\[$section\]/ a\\
  140. + sudo sed -i -e "/^\[$section\]/ a\\
  141. $option = $v
  142. " "$file"
  143. done
  144. @@ -201,7 +201,7 @@ function iniuncomment {
  145. local file=$1
  146. local section=$2
  147. local option=$3
  148. - sed -i -e "/^\[$section\]/,/^\[.*\]/ s|[^ \t]*#[ \t]*\($option[ \t]*=.*$\)|\1|" "$file"
  149. + sudo sed -i -e "/^\[$section\]/,/^\[.*\]/ s|[^ \t]*#[ \t]*\($option[ \t]*=.*$\)|\1|" "$file"
  150. $xtrace
  151. }
  152.  
  153. diff --git a/lib/apache b/lib/apache
  154. index c7d69f2..7dbbedc 100644
  155. --- a/lib/apache
  156. +++ b/lib/apache
  157. @@ -65,7 +65,7 @@ function install_apache_wsgi {
  158. # ensure mod_version enabled for <IfVersion ...>. This is
  159. # built-in statically on anything recent, but precise (2.2)
  160. # doesn't have it enabled
  161. - sudo a2enmod version || true
  162. + true
  163. }
  164.  
  165. # get_apache_version() - return the version of Apache installed
  166. diff --git a/lib/cinder b/lib/cinder
  167. index de41bc5..6b757b7 100644
  168. --- a/lib/cinder
  169. +++ b/lib/cinder
  170. @@ -175,13 +175,13 @@ function cleanup_cinder {
  171. function configure_cinder {
  172. sudo install -d -o $STACK_USER -m 755 $CINDER_CONF_DIR
  173.  
  174. - cp -p $CINDER_DIR/etc/cinder/policy.json $CINDER_CONF_DIR
  175. + sudo cp -p $CINDER_DIR/etc/cinder/policy.json $CINDER_CONF_DIR
  176.  
  177. rm -f $CINDER_CONF
  178.  
  179. configure_rootwrap cinder $CINDER_BIN_DIR/cinder-rootwrap $CINDER_DIR/etc/cinder
  180.  
  181. - cp $CINDER_DIR/etc/cinder/api-paste.ini $CINDER_API_PASTE_INI
  182. + sudo cp $CINDER_DIR/etc/cinder/api-paste.ini $CINDER_API_PASTE_INI
  183.  
  184. inicomment $CINDER_API_PASTE_INI filter:authtoken auth_host
  185. inicomment $CINDER_API_PASTE_INI filter:authtoken auth_port
  186. diff --git a/lib/glance b/lib/glance
  187. index 578c88a..a96e45f 100644
  188. --- a/lib/glance
  189. +++ b/lib/glance
  190. @@ -94,7 +94,7 @@ function configure_glance {
  191. sudo install -d -o $STACK_USER $GLANCE_CONF_DIR $GLANCE_METADEF_DIR
  192.  
  193. # Copy over our glance configurations and update them
  194. - cp $GLANCE_DIR/etc/glance-registry.conf $GLANCE_REGISTRY_CONF
  195. + sudo cp $GLANCE_DIR/etc/glance-registry.conf $GLANCE_REGISTRY_CONF
  196. iniset $GLANCE_REGISTRY_CONF DEFAULT debug $ENABLE_DEBUG_LOG_LEVEL
  197. inicomment $GLANCE_REGISTRY_CONF DEFAULT log_file
  198. local dburl=`database_connection_url glance`
  199. @@ -107,7 +107,7 @@ function configure_glance {
  200. fi
  201. iniset_rpc_backend glance $GLANCE_REGISTRY_CONF
  202.  
  203. - cp $GLANCE_DIR/etc/glance-api.conf $GLANCE_API_CONF
  204. + sudo cp $GLANCE_DIR/etc/glance-api.conf $GLANCE_API_CONF
  205. iniset $GLANCE_API_CONF DEFAULT debug $ENABLE_DEBUG_LOG_LEVEL
  206. inicomment $GLANCE_API_CONF DEFAULT log_file
  207. iniset $GLANCE_API_CONF DEFAULT sql_connection $dburl
  208. @@ -182,11 +182,11 @@ function configure_glance {
  209. setup_colorized_logging $GLANCE_REGISTRY_CONF DEFAULT tenant user
  210. fi
  211.  
  212. - cp -p $GLANCE_DIR/etc/glance-registry-paste.ini $GLANCE_REGISTRY_PASTE_INI
  213. + sudo cp -p $GLANCE_DIR/etc/glance-registry-paste.ini $GLANCE_REGISTRY_PASTE_INI
  214.  
  215. - cp -p $GLANCE_DIR/etc/glance-api-paste.ini $GLANCE_API_PASTE_INI
  216. + sudo cp -p $GLANCE_DIR/etc/glance-api-paste.ini $GLANCE_API_PASTE_INI
  217.  
  218. - cp $GLANCE_DIR/etc/glance-cache.conf $GLANCE_CACHE_CONF
  219. + sudo cp $GLANCE_DIR/etc/glance-cache.conf $GLANCE_CACHE_CONF
  220. iniset $GLANCE_CACHE_CONF DEFAULT debug $ENABLE_DEBUG_LOG_LEVEL
  221. inicomment $GLANCE_CACHE_CONF DEFAULT log_file
  222. iniset $GLANCE_CACHE_CONF DEFAULT use_syslog $SYSLOG
  223. @@ -206,10 +206,10 @@ function configure_glance {
  224. iniset $GLANCE_CACHE_CONF DEFAULT filesystem_store_datadir $GLANCE_IMAGE_DIR/
  225. iniset $GLANCE_CACHE_CONF glance_store filesystem_store_datadir $GLANCE_IMAGE_DIR/
  226.  
  227. - cp -p $GLANCE_DIR/etc/policy.json $GLANCE_POLICY_JSON
  228. - cp -p $GLANCE_DIR/etc/schema-image.json $GLANCE_SCHEMA_JSON
  229. + sudo cp -p $GLANCE_DIR/etc/policy.json $GLANCE_POLICY_JSON
  230. + sudo cp -p $GLANCE_DIR/etc/schema-image.json $GLANCE_SCHEMA_JSON
  231.  
  232. - cp -p $GLANCE_DIR/etc/metadefs/*.json $GLANCE_METADEF_DIR
  233. + sudo cp -p $GLANCE_DIR/etc/metadefs/*.json $GLANCE_METADEF_DIR
  234.  
  235. if is_ssl_enabled_service "cinder" || is_service_enabled tls-proxy; then
  236. CINDER_SERVICE_HOST=${CINDER_SERVICE_HOST:-$SERVICE_HOST}
  237. diff --git a/lib/keystone b/lib/keystone
  238. index 997bb14..8aed369 100644
  239. --- a/lib/keystone
  240. +++ b/lib/keystone
  241. @@ -191,10 +191,10 @@ function configure_keystone {
  242. sudo install -d -o $STACK_USER $KEYSTONE_CONF_DIR
  243.  
  244. if [[ "$KEYSTONE_CONF_DIR" != "$KEYSTONE_DIR/etc" ]]; then
  245. - install -m 600 $KEYSTONE_DIR/etc/keystone.conf.sample $KEYSTONE_CONF
  246. - cp -p $KEYSTONE_DIR/etc/policy.json $KEYSTONE_CONF_DIR
  247. + sudo install -m 600 $KEYSTONE_DIR/etc/keystone.conf.sample $KEYSTONE_CONF
  248. + sudo cp -p $KEYSTONE_DIR/etc/policy.json $KEYSTONE_CONF_DIR
  249. if [[ -f "$KEYSTONE_DIR/etc/keystone-paste.ini" ]]; then
  250. - cp -p "$KEYSTONE_DIR/etc/keystone-paste.ini" "$KEYSTONE_PASTE_INI"
  251. + sudo cp -p "$KEYSTONE_DIR/etc/keystone-paste.ini" "$KEYSTONE_PASTE_INI"
  252. fi
  253. fi
  254. if [[ -f "$KEYSTONE_PASTE_INI" ]]; then
  255. @@ -237,6 +237,9 @@ function configure_keystone {
  256.  
  257. iniset_rpc_backend keystone $KEYSTONE_CONF
  258.  
  259. + # Set the URL advertised in the ``versions`` structure returned by the '/' route
  260. + iniset $KEYSTONE_CONF DEFAULT public_endpoint "$KEYSTONE_SERVICE_PROTOCOL://$KEYSTONE_SERVICE_HOST:$KEYSTONE_SERVICE_PORT/"
  261. + iniset $KEYSTONE_CONF DEFAULT admin_endpoint "$KEYSTONE_SERVICE_PROTOCOL://$KEYSTONE_SERVICE_HOST:$KEYSTONE_AUTH_PORT/"
  262. iniset $KEYSTONE_CONF eventlet_server admin_bind_host "$KEYSTONE_ADMIN_BIND_HOST"
  263.  
  264. # Register SSL certificates if provided
  265. @@ -294,7 +297,7 @@ function configure_keystone {
  266. echo "catalog.RegionOne.network.name = Neutron Service" >> $KEYSTONE_CATALOG
  267. fi
  268.  
  269. - sed -e "
  270. + sudo sed -e "
  271. s,%SERVICE_HOST%,$SERVICE_HOST,g;
  272. s,%S3_SERVICE_PORT%,$S3_SERVICE_PORT,g;
  273. " -i $KEYSTONE_CATALOG
  274. @@ -342,9 +345,9 @@ function configure_keystone_extensions {
  275. continue
  276. fi
  277. api_v3=$(iniget $KEYSTONE_PASTE_INI pipeline:api_v3 pipeline)
  278. - extension=$(echo $api_v3 | sed -ne "/${extension_value}/ p;" )
  279. + extension=$(echo $api_v3 | sudo sed -ne "/${extension_value}/ p;" )
  280. if [[ -z $extension ]]; then
  281. - api_v3_extension=$(echo $api_v3 | sed -ne "s/service_v3/${extension_value}_extension service_v3/p;" )
  282. + api_v3_extension=$(echo $api_v3 | sudo sed -ne "s/service_v3/${extension_value}_extension service_v3/p;" )
  283. iniset $KEYSTONE_PASTE_INI pipeline:api_v3 pipeline "$api_v3_extension"
  284. fi
  285. done
  286. diff --git a/lib/nova b/lib/nova
  287. index 807dfce..491df95 100644
  288. --- a/lib/nova
  289. +++ b/lib/nova
  290. @@ -234,7 +234,7 @@ function configure_nova {
  291.  
  292. if [[ "$ENABLED_SERVICES" =~ "n-api" ]]; then
  293. # Get the sample configuration file in place
  294. - cp $NOVA_DIR/etc/nova/api-paste.ini $NOVA_CONF_DIR
  295. + sudo cp $NOVA_DIR/etc/nova/api-paste.ini $NOVA_CONF_DIR
  296.  
  297. # For testing v21 is equivalent to v2
  298. if [[ "$NOVA_API_VERSION" == "v21default" ]]; then
  299. diff --git a/stack.sh b/stack.sh
  300. index 48fbe8a..af9923c 100755
  301. --- a/stack.sh
  302. +++ b/stack.sh
  303. @@ -969,6 +969,7 @@ if is_service_enabled keystone; then
  304. echo_summary "Starting Keystone"
  305.  
  306. if [ "$KEYSTONE_AUTH_HOST" == "$SERVICE_HOST" ]; then
  307. + sudo chown stack:stack /etc/keystone/keystone.conf
  308. init_keystone
  309. start_keystone
  310. fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement