Provide credentials via ceilometer config file

Fixes bug 1076831

Previously we passed these credentials to the ceilometer central
agent via the OS_* environment variables.

Since these credentials are now needed by the compute agent also,
and have already leaked into the config file to enable the keystone
auth token middleware, we now switch over to using the config file
only and drop the environment variable usage.

Change-Id: I0298d711905a99aa5355fe034bb0e51e53b3be21
diff --git a/lib/ceilometer b/lib/ceilometer
index 2b014b0..aa1b396 100644
--- a/lib/ceilometer
+++ b/lib/ceilometer
@@ -66,6 +66,13 @@
     cp $CEILOMETER_DIR/etc/ceilometer/policy.json $CEILOMETER_CONF_DIR
     iniset $CEILOMETER_CONF DEFAULT policy_file $CEILOMETER_CONF_DIR/policy.json
 
+    # the compute and central agents need these credentials in order to
+    # call out to the public nova and glance APIs
+    iniset $CEILOMETER_CONF DEFAULT os_username ceilometer
+    iniset $CEILOMETER_CONF DEFAULT os_password $SERVICE_PASSWORD
+    iniset $CEILOMETER_CONF DEFAULT os_tenant_name $SERVICE_TENANT_NAME
+    iniset $CEILOMETER_CONF DEFAULT os_auth_url $OS_AUTH_URL
+
     iniset $CEILOMETER_CONF keystone_authtoken auth_protocol http
     iniset $CEILOMETER_CONF keystone_authtoken admin_user ceilometer
     iniset $CEILOMETER_CONF keystone_authtoken admin_password $SERVICE_PASSWORD
@@ -82,7 +89,7 @@
 # start_ceilometer() - Start running processes, including screen
 function start_ceilometer() {
     screen_it ceilometer-acompute "cd $CEILOMETER_DIR && sg libvirtd \"$CEILOMETER_BIN_DIR/ceilometer-agent-compute --config-file $CEILOMETER_CONF\""
-    screen_it ceilometer-acentral "export OS_USERNAME=ceilometer OS_PASSWORD=$SERVICE_PASSWORD OS_TENANT_NAME=$SERVICE_TENANT_NAME OS_AUTH_URL=$OS_AUTH_URL && cd $CEILOMETER_DIR && $CEILOMETER_BIN_DIR/ceilometer-agent-central --config-file $CEILOMETER_CONF"
+    screen_it ceilometer-acentral "cd $CEILOMETER_DIR && $CEILOMETER_BIN_DIR/ceilometer-agent-central --config-file $CEILOMETER_CONF"
     screen_it ceilometer-collector "cd $CEILOMETER_DIR && $CEILOMETER_BIN_DIR/ceilometer-collector --config-file $CEILOMETER_CONF"
     screen_it ceilometer-api "cd $CEILOMETER_DIR && $CEILOMETER_BIN_DIR/ceilometer-api -d -v --log-dir=$CEILOMETER_API_LOG_DIR --config-file $CEILOMETER_CONF"
 }