Skip to content

Commit

Permalink
refs #24055 - fix env save error
Browse files Browse the repository at this point in the history
  • Loading branch information
thomasmckay committed Jul 31, 2018
1 parent 725cfe7 commit e127ad7
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 8 deletions.
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

0 comments on commit e127ad7

Please sign in to comment.