Bug #6652

[API] Error "Owner uuid must refer to a user with a username" when creating a new repository.

Added by Radhika Chippada over 4 years ago. Updated about 4 years ago.

Status:
Resolved
Priority:
Normal
Assigned To:
Category:
API
Target version:
Start date:
08/13/2015
Due date:
% Done:

100%

Estimated time:
(Total: 0.00 h)
Story points:
0.5

Description

Ways to create a new repo:
  • Admin gear menu → Repositories → "Add a new repository" button -- fail
  • User menu → Manage Account → "Add new repository" button -- success
  • arv repository create --repository '{"name":"myusername/foobar"}' -- fail
I suspect this is a problem with validation order:

If these happened in the reverse order, :valid_owner would pass.


Subtasks

Task #6979: Do not offer "Add a new repository" and "Add a new SSH key" buttons when admin settings pages are accessed.ResolvedManoj Malipeddu

Task #6990: Review 6652-test-system-menuResolved

Associated revisions

Revision 9b2bf1dd
Added by Manoj Malipeddu about 4 years ago

closes #6652
Merge branch '6652-test-system-menu'

Revision b5e687f6 (diff)
Added by Tom Clegg about 4 years ago

6663: Fix using default owner_uuid in repositories#create. refs #6652

Revision 9fd9565e (diff)
Added by Tom Clegg about 4 years ago

6663: Fix using default owner_uuid in repositories#create. refs #6652

Revision c1ceb0f7
Added by Manoj Malipeddu about 4 years ago

closes #6652
Merge branch '6652-test-system-menu'

History

#1 Updated by Tom Clegg over 4 years ago

  • Subject changed from [Workbench] Fiddlesticks error "Owner uuid must refer to a user with a username" error accessing "Add a new repository" button in the settings menu. Works in "manage account" page. to [API] Error "Owner uuid must refer to a user with a username" when creating a new repository.
  • Description updated (diff)

#2 Updated by Tom Clegg over 4 years ago

  • Category set to API
  • Story points set to 0.5

This might be easy to fix by moving self.owner_uuid ||= current_user.uuid into a before_validation method.

(Obviously it needs a test case, too.)

#3 Updated by Manoj Malipeddu over 4 years ago

In 4999699d7614f214eb8718b85c5c30e9fb382c23:

Added tests for the system menu and the pages in the dropdown menu.

#4 Updated by Manoj Malipeddu about 4 years ago

In 61d432f332dd9314f8c4cd57c2393e80e8ecef59:

System menu test now skips repositories and test has been moved to application_layout_test.

#5 Updated by Manoj Malipeddu about 4 years ago

  • Status changed from New to Resolved
  • % Done changed from 0 to 100

Applied in changeset arvados|commit:9b2bf1dddd21c991623e4b2b8b412e1f3fb05d34.

#6 Updated by Brett Smith about 4 years ago

  • Status changed from Resolved to New

Re-opening this because it doesn't sound like we made the desired API changes.

#7 Updated by Brett Smith about 4 years ago

  • Target version changed from Bug Triage to 2015-09-02 sprint

#8 Updated by Radhika Chippada about 4 years ago

I played with Tom's suggestion "moving self.owner_uuid ||= current_user.uuid into a before_validation method" and this does not solve the problem.

Once this is in place, the creation fails on name_format check. Thus, to solve this:
  • need to make the API update
  • update workbench to show the same popup as in user/repositories page. Alternatively, we can hide the New button admin#repositories page. I think this might actually be the right option, because what good is it to create all these repositories as <admin_user>/repo_name?
  • "arv repository create" should work provided name is provided as in Tom's example in the description.

#9 Updated by Brett Smith about 4 years ago

  • Target version changed from 2015-09-02 sprint to Arvados Future Sprints

#10 Updated by Brett Smith about 4 years ago

  • Target version changed from Arvados Future Sprints to 2015-09-02 sprint

#11 Updated by Brett Smith about 4 years ago

  • Target version changed from 2015-09-02 sprint to Arvados Future Sprints

#12 Updated by Tom Clegg about 4 years ago

  • Status changed from New to Resolved

This bug was fixed and merged with #6663. Now this succeeds:

$ arv repository create --repository '{"name":"myusername/foobar"}'
Workbench still has a non-functional "Add repository" button on the /repositories page (which is linked from the admin menu) but
  • it now gives a legitimate error that indicates a Workbench flaw instead of an API flaw: "Name must be the owner's username, then '/', then a letter followed by alphanumerics"
  • that button is useless anyway because users can create their own repositories on the user menu -> Repositories page. It should be removed.

#13 Updated by Radhika Chippada about 4 years ago

  • Status changed from Resolved to In Progress
  • Assigned To set to Manoj Malipeddu
  • Target version changed from Arvados Future Sprints to 2015-08-19 sprint

#14 Updated by Radhika Chippada about 4 years ago

Reopening to address the last comment added by Tom in note #12.

So, what needs to be done: When accessed from admin settings menu,

  • /repositories page should not offer the "Add a new repository" button
  • /authorized_keys page also does not need to offer the "Add a new authorized key" button.

#15 Updated by Manoj Malipeddu about 4 years ago

In 84d14d659b8c31c266a3b08e688171f90fe46cad:

Add a new repository and add a new authorized key buttons no longer appear in the admin pages and tests have been updated.

#16 Updated by Radhika Chippada about 4 years ago

Review comments:

  • Please add an else block for "if add_button_text" in the test
      if add_button_text
        assert_selector 'button', text: "Add a new #{add_button_text}" 
        find('button', text: "Add a new #{add_button_text}").click
      else
        assert_no_selector 'button', text: "Add a new" 
      end
  • Can you please use "assert_text" instead of "page.has_text?" in the last statement of the test

Thanks.

#17 Updated by Manoj Malipeddu about 4 years ago

In 3bfb9c5cbf5dd56b84fd17f9e1dcdd6a219fe5fe:

Added else statement and changed assertion to use assert_text in "test system menu #{page_name} link".

#18 Updated by Manoj Malipeddu about 4 years ago

  • Status changed from In Progress to Resolved
  • % Done changed from 0 to 100

Applied in changeset arvados|commit:c1ceb0f74d5547c56cf6cdde56044adba171efaf.

Also available in: Atom PDF