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

refs #24055 - fix env save error #7579

Merged
merged 1 commit into from Jul 31, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 0 additions & 1 deletion app/controllers/katello/api/v2/environments_controller.rb
Expand Up @@ -104,7 +104,6 @@ def update
fail HttpErrors::BadRequest, _("Can't update the '%s' environment") % "Library" if @environment.library? && update_params.empty?
update_params[:name] = params[:environment][:new_name] if params[:environment][:new_name]
@environment.update_attributes!(update_params)
@environment.update_container_repositories(update_params[:registry_unauthenticated_pull]) if update_params.key? :registry_unauthenticated_pull
if update_params[:registry_name_pattern]
task = send(async ? :async_task : :sync_task, ::Actions::Katello::Environment::PublishRepositories,
@environment, content_type: Katello::Repository::DOCKER_TYPE)
Expand Down
6 changes: 0 additions & 6 deletions app/models/katello/kt_environment.rb
Expand Up @@ -221,12 +221,6 @@ def puppet_repositories
self.repositories.readable.where(:content_type => Katello::Repository::PUPPET_TYPE)
end

def update_container_repositories(registry_unauthenticated_pull)
self.repositories.readable.where(:content_type => Katello::Repository::DOCKER_TYPE).each do |repository|
repository.update_attributes!(registry_unauthenticated_pull: registry_unauthenticated_pull)
end
end

def as_json(_options = {})
to_ret = self.attributes
to_ret['prior'] = self.prior && self.prior.name
Expand Down
4 changes: 3 additions & 1 deletion test/controllers/api/v2/environments_controller_test.rb
Expand Up @@ -144,14 +144,16 @@ def test_update
put :update, params: { :organization_id => @organization.id, :id => @staging.id, :environment => {
:new_name => new_name,
:label => 'New Label',
:description => new_description
:description => new_description,
:registry_unauthenticated_pull => true
} }

assert_response :success
assert_template 'api/v2/common/update'
@staging.reload
assert_equal new_name, @staging.name
assert_equal new_description, @staging.description
assert_equal true, @staging.registry_unauthenticated_pull
# note: label is not editable; therefore, confirm that it is unchanged
assert_equal original_label, @staging.label
end
Expand Down