Exemplo n.º 1
0
 def _createProjectForAccount(self, project_name):
     """
     创建项目
     :param project_name:
     :return: project_id
     """
     command = "openstack project create " + project_name + " -f json"
     command = self._authTool.insertAdminAuth(command)
     tmp_project_id = subprocess.check_output(command, shell=True)
     project_id = StrTool.getStringWithDic(tmp_project_id, "id")
     if not project_id:
         return None
     return project_id
Exemplo n.º 2
0
 def _createUserForAccount(self, user_name, password):
     """
     创建用户
     :param user_name:
     :param password:
     :return: user_id
     """
     command = "openstack user create " + user_name + " --password " + password + " -f json"
     command = self._authTool.insertAdminAuth(command)
     tmp_user_id = subprocess.check_output(command, shell=True)
     user_id = StrTool.getStringWithDic(tmp_user_id, "id")
     if not user_id:
         return None
     return user_id