0

I'm trying to add a column to the User model under keystone/identity/backends/sql.py. I'm also using devstack to set things up.

However, when I run stack.sh, I'm getting this error:

+ [[ g-api,g-reg,key,n-api,n-crt,n-obj,n-cpu,n-net,n-cond,cinder,c-sch,c-api,c-vol,n-sch,n-novnc,n-xvnc,n-cauth,horizon,rabbit,tempest,mysql =~ tempest ]]
++ get_id keystone tenant-create --name=alt_demo
+++ awk '/ id / { print $4 }'
+++ keystone tenant-create --name=alt_demo
++ echo ad1bcb522efd46ccbad8f6a47e1161a9
+ ALT_DEMO_TENANT=ad1bcb522efd46ccbad8f6a47e1161a9
++ get_id keystone user-create --name=alt_demo --pass=123456 --email=alt_demo@example.com
+++ keystone user-create --name=alt_demo --pass=123456 --email=alt_demo@example.com
+++ awk '/ id / { print $4 }'
Conflict occurred attempting to store user. (1054, "Unknown column 'tfa_enabled' in 'field list'") (HTTP 409)
++ echo
+ ALT_DEMO_USER=
+ keystone user-role-add --tenant-id ad1bcb522efd46ccbad8f6a47e1161a9 --user-id --role-id dff99958c9ec4b19b656c52f52469589
usage: keystone user-role-add --user <user> --role <role> [--tenant <tenant>]
keystone user-role-add: error: argument --user/--user-id/--user_id: expected one argument
++ failed
++ local r=2
+++ jobs -p
++ kill
++ set +o xtrace

The key part of the log is:

Conflict occurred attempting to store user. (1054, "Unknown column 'tfa_enabled' in 'field list'") (HTTP 409)

where tfa_enabled is the column I'm trying to add.

Does anyone know what's going on? Is there some other code I need to modify?

Thanks!

Roman Bodnarchuk
  • 29,461
  • 12
  • 59
  • 75
Derek Chiang
  • 3,330
  • 6
  • 27
  • 34

1 Answers1

0

As far as I am getting this, you are trying to add a new column to the table filed list. Are you able to see the column in the database? If not, then I guess it's because you haven't added the column to the table.

The way to do this is you need to add the database migration. Go to keystone/common/sql/migrate_repo/version and add the modified version with the next number.After adding the migration file run "keystone-manage db_sync" and you should be able to see the new column in the database. HTH.

Pensu
  • 3,263
  • 10
  • 46
  • 71