Skip to content

Duplicated keys on restore #117

Description

@sixela

Hello,

Not sure to understand the expected behavior when restoring.

First of all let me know if I mistaken but, in my understanding of the tool I should be able to run knife ec restore even on a live instance, right ?

I'm surprised to see that when I try to restore several times the instance I see lots of errors regarding duplicated keys, either for the org or for individual users:

For the org:

2018-01-25_18:18:19.59247 ERROR:  duplicate key value violates unique constraint "orgs_name_key"
2018-01-25_18:18:19.59257 DETAIL:  Key (name)=(myorgname) already exists.
2018-01-25_18:18:19.59257 STATEMENT:  INSERT INTO orgs (id, authz_id, name, full_name, assigned_at, last_updated_by, created_at, updated_at) VALUES ($1, $2, $3, $4, $5, $6, $7, $8)

For a user:

2018-01-29_09:49:01.66498 ERROR:  duplicate key value violates unique constraint "users_username_key"
2018-01-29_09:49:01.66500 DETAIL:  Key (username)=(myuser) already exists.
2018-01-29_09:49:01.66501 CONTEXT:  SQL statement "WITH createduser AS
2018-01-29_09:49:01.66501             (INSERT INTO users
2018-01-29_09:49:01.66501               (id, authz_id, username, email, public_key, hashed_password, salt, hash_type,
2018-01-29_09:49:01.66501                last_updated_by, created_at, updated_at, external_authentication_uid,
2018-01-29_09:49:01.66501                recovery_authentication_enabled, serialized_object, admin,
2018-01-29_09:49:01.66501                pubkey_version)
2018-01-29_09:49:01.66501              VALUES (p_id, p_authz_id, p_username, p_email, 'this_is_not_a_key',
2018-01-29_09:49:01.66502                p_hashed_password, p_salt, p_hash_type, p_last_updated_by, p_created_at, p_updated_at,
2018-01-29_09:49:01.66502                p_external_authentication_uid, p_recovery_authentication_enabled,
2018-01-29_09:49:01.66502                p_serialized_object, p_admin, p_pubkey_version) RETURNING 1)
2018-01-29_09:49:01.66502             SELECT count(*) FROM createduser"
2018-01-29_09:49:01.66502       PL/pgSQL function add_user(character,character,text,text,text,integer,text,text,password_hash_type,character,timestamp without time zone,timestamp without time zone,text,boolean,text,boolean) line 13 at SQL statement
2018-01-29_09:49:01.66503 STATEMENT:  SELECT add_user($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, false)

Related logs in erchef:

2018-01-29_08:18:47.00917 [error] {<<"method=POST; path=/users; status=409; ">>,"Conflict"}
2018-01-29_08:18:52.11723 [error] {<<"method=POST; path=/organizations; status=409; ">>,"Conflict"}

Is that expected ? Not sure where to look

Edit: knife-ec-backup gem is 2.2.3 / chef-server is (rpm) 12.17.5

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions