第二次运行 postgres_database.present 会导致错误“具有错误的参数,无法动态更改”

第二次运行 postgres_database.present 会导致错误“具有错误的参数,无法动态更改”

运行如下所示的 salt 状态来为 django 创建 postgres 数据库...

django-db:
  postgres_database.present:
  - encoding: 'UTF-8'
  - owner: djangouser
  - db_user: postgres

当我第一次运行它时,到目前为止一切顺利:

      ID: django-db
Function: postgres_database.present
  Result: True
 Comment: The database django-db has been created
 Started: 20:59:01.148225
Duration: 494.007 ms
 Changes:
          ----------
          django-db:
              Present

但是当我再次运行它时,结果却错误:

      ID: django-db
Function: postgres_database.present
  Result: False
 Comment: Database django-db has wrong parameters which couldn't be changed on fly.
 Started: 21:04:14.289538
Duration: 101.216 ms
 Changes:

答案1

感谢 IRC 上的用户 martin_,问题在于“UTF-8”中的连字符。状态应该是

django-db:
  postgres_database.present:
  - encoding: 'UTF8'
  - owner: djangouser
  - db_user: postgres

http://irclog.perlgeek.de/salt/2014-08-30/text

相关内容