protected function writeConfig()
 {
     $configPath = ROOT_PATH . "/module/Scloud/config/openstack.yaml";
     $tenantService = $this->getServiceLocator()->get("tenant_service");
     $roleService = $this->getServiceLocator()->get("role_service");
     if (!file_exists($configPath)) {
         $config = new Config(array(), true);
         $config->openstack = array();
         $tenantService->getToken();
         $config->openstack->admin_tenant_id = $tenantService->getTenantId("admin");
         $roleService->getToken();
         $config->openstack->member_role_id = $roleService->getRoleId(array("role_name" => "Member"));
         $writer = new YamlWriter();
         file_put_contents($configPath, $writer->toString($config));
     }
     $reader = new YamlReader();
     return $reader->fromFile($configPath);
 }