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

Fixes #12405: move packages from system to host. #5656

Merged
merged 1 commit into from Jan 18, 2016

Conversation

waldenraines
Copy link
Contributor

http://projects.theforeman.org/issues/12405

Do not merge until this PR has an associated ACK'd hammer PR.

@system = System.where(:uuid => params[:system_id]).first
fail HttpErrors::NotFound, _("Couldn't find system '%s'") % params[:system_id] if @system.nil?
@system = System.where(:host_id => params[:host_id]).first
fail HttpErrors::NotFound, _("Couldn't find system with host id '%s'") % params[:host_id] if @system.nil?
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be Couldn't find host ?

@waldenraines
Copy link
Contributor Author

Associated hammer pr: Katello/hammer-cli-katello#340

def find_host
@host = ::Host::Managed.find(params[:host_id])
fail HttpErrors::NotFound, _("Couldn't find host with host id '%s'") % params[:host_id] if @host.nil?
@host
end
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would add a check here to verify the host has a content facet and a uuid in that content facet (implying its registered via pulp)

@waldenraines
Copy link
Contributor Author

@ehelms @jlsherrill updated.

@jlsherrill
Copy link
Member

Couple of comments:

a) you might also add nvra as searchable
b) The package list isn't sorted at all, should likely default to being sorted by name
c) The package list for a host is paged, but that page only has a filter, we probably want to change it to be a full search. Maybe convert this to details nutupane?
d) The package list table seems 'off':

asdf
e) The 'remove' button beside each package is missing, i'm pretty sure this is an existing problem but if its a simple fix, would be great to fix it here (especially if converting to details-nutupane)

@waldenraines
Copy link
Contributor Author

@jlsherrill updated.

fail HttpErrors::NotFound, _("Couldn't find system '%s'") % params[:system_id] if @system.nil?
@system
def find_host
@host = ::Host::Managed.find(params[:host_id])
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As mentioned in your other PR, this doesn't properly check authorization

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks like its still not properly authorizing

@jlsherrill
Copy link
Member

Also discovered that we need something like this:

    resource_description do
      api_version 'v2'
      api_base_url "/api"
    end

in any controller that is under /api/hosts (and not under /katello/api)

@waldenraines
Copy link
Contributor Author

Also discovered that we need something like this:

resource_description do
  api_version 'v2'
  api_base_url "/api"
end

in any controller that is under /api/hosts (and not under /katello/api)

See https://github.com/Katello/katello/pull/5656/files#diff-c488bbb43ed74b3c1446892671b7afe8R7

@waldenraines
Copy link
Contributor Author

@jlsherrill updated.

query = @host.installed_packages
collection = scoped_search(query.uniq, :name, :asc, :resource_class => ::Katello::InstalledPackage)
respond_for_index(:collection => collection)
end
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would you be up for adding auto-complete support. Its really easy! :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added.

@jlsherrill
Copy link
Member

Everything else looks great and works fine. After those 3 fixes I think its good to go.

@waldenraines
Copy link
Contributor Author

@jlsherrill updated.

@jlsherrill
Copy link
Member

ACK

waldenraines pushed a commit that referenced this pull request Jan 18, 2016
Fixes #12405: move packages from system to host.
@waldenraines waldenraines merged commit ccf6ed2 into Katello:master Jan 18, 2016
@waldenraines waldenraines deleted the 12405 branch January 18, 2016 18:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants