Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot update the account of a rule #3794

Closed
dchristidis opened this issue Jun 30, 2020 · 2 comments
Closed

Cannot update the account of a rule #3794

dchristidis opened this issue Jun 30, 2020 · 2 comments
Assignees
Milestone

Comments

@dchristidis
Copy link
Contributor

Motivation

$ rucio update-rule --account ACCOUNT RULEID
2020-06-30 12:37:21,205 ERROR   An unknown exception occurred.
Details: Badly formatted rule id (RULEID)
[Tue Jun 30 12:37:21.201390 2020] [:error] [pid 21435:tid 139789737174784] (rucio.common.exception.InvalidType) Provided type is considered invalid.
[Tue Jun 30 12:37:21.201461 2020] [:error] [pid 21435:tid 139789737174784] Details: Cannot insert to db. Expected InternalAccount, got string type.
[Tue Jun 30 12:37:21.201465 2020] [:error] [pid 21435:tid 139789737174784] [SQL: SELECT atlas_rucio_accounts_acc_1, atlas_rucio_accounts_acc_2, atlas_rucio_accounts_sta_3, atlas_rucio_accounts_ema_4, atlas_rucio_accounts_sus_5, atlas_rucio_accounts_del_6, atlas_rucio_accounts_upd_7, atlas_rucio_accounts_cre_8 
[Tue Jun 30 12:37:21.201469 2020] [:error] [pid 21435:tid 139789737174784] FROM (SELECT atlas_rucio.accounts.account AS atlas_rucio_accounts_acc_1, atlas_rucio.accounts.account_type AS atlas_rucio_accounts_acc_2, atlas_rucio.accounts.status AS atlas_rucio_accounts_sta_3, atlas_rucio.accounts.email AS atlas_rucio_accounts_ema_4, atlas_rucio.accounts.suspended_at AS atlas_rucio_accounts_sus_5, atlas_rucio.accounts.deleted_at AS atlas_rucio_accounts_del_6, atlas_rucio.accounts.updated_at AS atlas_rucio_accounts_upd_7, atlas_rucio.accounts.created_at AS atlas_rucio_accounts_cre_8 
[Tue Jun 30 12:37:21.201472 2020] [:error] [pid 21435:tid 139789737174784] FROM atlas_rucio.accounts 
[Tue Jun 30 12:37:21.201475 2020] [:error] [pid 21435:tid 139789737174784] WHERE atlas_rucio.accounts.account = :account_1) 
[Tue Jun 30 12:37:21.201477 2020] [:error] [pid 21435:tid 139789737174784] WHERE ROWNUM <= :param_1]
[Tue Jun 30 12:37:21.201482 2020] [:error] [pid 21435:tid 139789737174784] [parameters: [{}]]

Modification

@patrick-austin
Copy link
Contributor

patrick-austin commented Jun 30, 2020

Update rule uses a dictionary of options which can contain an account, but we missed this when implementing InternalAccount types as it didn't appear as an argument to the API function directly.

Have submitted a PR which fixes this, but I also want to check we haven't missed anywhere else doing a similar thing, and possibly add a test that explicitly tests this (currently test_rule.py adds a rule with the option account but it does this directly via the core, so this test didn't expose the missing conversion as that happens at the API layer).

@patrick-austin
Copy link
Contributor

Found a couple of places where an account could be included in a dictionary representing a DID, and passed through the API layer without conversion to InternalAccount. Normally this account is simply not included and the issuer is used instead at the core without issue. However if an account was provided it would cause a similar error to this, so I added checks to make sure any optional accounts are now converted.
Also modified some existing tests so they test these new conversions.

@bari12 bari12 closed this as completed in 1328458 Jul 23, 2020
bari12 added a commit that referenced this issue Jul 23, 2020
…ptions_to_internal

bug, Core & Internals: Convert update rule options to internal #3794
@bari12 bari12 added this to the 1.23.2 milestone Jul 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants