Bug 1515894

Summary: [RFE] Service pane service/explorer Unexpecting error encountered
Product: Red Hat CloudForms Management Engine Reporter: Satoe Imaishi <simaishi>
Component: AutomateAssignee: drew uhlmann <duhlmann>
Status: CLOSED CURRENTRELEASE QA Contact: Shveta <sshveta>
Severity: low Docs Contact:
Priority: medium    
Version: 5.8.0CC: akarol, fgrosjea, jhardy, jocarter, mfeifer, mkanoor, obarenbo, sshveta, tfitzger
Target Milestone: GAKeywords: FutureFeature, RFE
Target Release: 5.9.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: 5.9.0.10 Doc Type: Enhancement
Doc Text:
Story Points: ---
Clone Of: 1505033 Environment:
Last Closed: 2018-03-06 15:22:09 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: CFME Core Target Upstream Version:
Embargoed:
Bug Depends On: 1505033    
Bug Blocks:    

Comment 2 CFME Bot 2017-11-29 20:47:13 UTC
New commit detected on ManageIQ/manageiq-automation_engine/gaprindashvili:
https://github.com/ManageIQ/manageiq-automation_engine/commit/d705a2f0064f00cae27edca2bc88bcd1e5b256fd

commit d705a2f0064f00cae27edca2bc88bcd1e5b256fd
Author:     Greg McCullough <gmccullo>
AuthorDate: Mon Nov 20 15:46:27 2017 -0500
Commit:     Satoe Imaishi <simaishi>
CommitDate: Tue Nov 21 09:54:43 2017 -0500

    Merge pull request #118 from d-m-u/bz1505033
    
    Changes service name update to raise errors
    (cherry picked from commit 89e0003b35c89fe506d63fb1838102cbaf80fc12)
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1515894

 lib/miq_automation_engine/service_models/miq_ae_service_service.rb | 3 +--
 spec/service_models/miq_ae_service_service_spec.rb                 | 4 ++++
 2 files changed, 5 insertions(+), 2 deletions(-)

Comment 3 Shveta 2018-02-16 21:36:50 UTC
I am still able to update service_name to null.
Version : 5.9.0.21.20180214154720_6f2109d

Appliance : https://10.8.198.52
through psql I ran : 
UPDATE services SET name = null WHERE id = 1;

Comment 4 drew uhlmann 2018-02-19 14:55:12 UTC
Hi Shveta! Changing the service name via a database call like that is not going to run any Rails validations. That's expected behavior. I can't replicate being able to set the name to nil without hitting an error now, and without the the automation logs from the 2017 run where this broke originally I can't tell that anything is still wrong with this. You can see that the validation on the name runs by running the following line in rails console: 

Service.first.update_attributes!(:name => nil)

which should fail with an error about the name being blank.

Comment 5 Shveta 2018-02-19 16:28:05 UTC
rails c
Loading production environment (Rails 5.0.6)
irb(main):001:0> Service.first.update_attributes!(:name => nil)
PostgreSQLAdapter#log_after_checkout, connection_pool: size: 5, connections: 1, in use: 1, waiting_in_queue: 0
ActiveRecord::RecordInvalid: Validation failed: Name can't be blank
	from /opt/rh/cfme-gemset/gems/activerecord-5.0.6/lib/active_record/validations.rb:78:in `raise_validation_error'
	from /opt/rh/cfme-gemset/gems/activerecord-5.0.6/lib/active_record/validations.rb:50:in `save!'
	from /opt/rh/cfme-gemset/gems/activerecord-5.0.6/lib/active_record/attribute_methods/dirty.rb:30:in `save!'
	from /opt/rh/cfme-gemset/gems/activerecord-5.0.6/lib/active_record/transactions.rb:324:in `block in save!'
	from /opt/rh/cfme-gemset/gems/activerecord-5.0.6/lib/active_record/transactions.rb:395:in `block in with_transaction_returning_status'
	from /opt/rh/cfme-gemset/gems/activerecord-5.0.6/lib/active_record/connection_adapters/abstract/database_statements.rb:230:in `transaction'
	from /opt/rh/cfme-gemset/gems/activerecord-5.0.6/lib/active_record/transactions.rb:211:in `transaction'
	from /opt/rh/cfme-gemset/gems/activerecord-5.0.6/lib/active_record/transactions.rb:392:in `with_transaction_returning_status'
	from /opt/rh/cfme-gemset/gems/activerecord-5.0.6/lib/active_record/transactions.rb:324:in `save!'
	from /opt/rh/cfme-gemset/gems/activerecord-5.0.6/lib/active_record/suppressor.rb:45:in `save!'
	from /opt/rh/cfme-gemset/gems/activerecord-5.0.6/lib/active_record/persistence.rb:288:in `block in update!'
	from /opt/rh/cfme-gemset/gems/activerecord-5.0.6/lib/active_record/transactions.rb:395:in `block in with_transaction_returning_status'
	from /opt/rh/cfme-gemset/gems/activerecord-5.0.6/lib/active_record/connection_adapters/abstract/database_statements.rb:232:in `block in transaction'
	from /opt/rh/cfme-gemset/gems/activerecord-5.0.6/lib/active_record/connection_adapters/abstract/transaction.rb:189:in `within_new_transaction'
	from /opt/rh/cfme-gemset/gems/activerecord-5.0.6/lib/active_record/connection_adapters/abstract/database_statements.rb:232:in `transaction'
	from /opt/rh/cfme-gemset/gems/activerecord-5.0.6/lib/active_record/transactions.rb:211:in `transaction'
	from /opt/rh/cfme-gemset/gems/activerecord-5.0.6/lib/active_record/transactions.rb:392:in `with_transaction_returning_status'
	from /opt/rh/cfme-gemset/gems/activerecord-5.0.6/lib/active_record/persistence.rb:286:in `update!'
	from (irb):1
	from /opt/rh/cfme-gemset/gems/railties-5.0.6/lib/rails/commands/console.rb:65:in `start'
	from /opt/rh/cfme-gemset/gems/railties-5.0.6/lib/rails/commands/console_helper.rb:9:in `start'
	from /opt/rh/cfme-gemset/gems/railties-5.0.6/lib/rails/commands/commands_tasks.rb:78:in `console'
	from /opt/rh/cfme-gemset/gems/railties-5.0.6/lib/rails/commands/commands_tasks.rb:49:in `run_command!'
	from /opt/rh/cfme-gemset/gems/railties-5.0.6/lib/rails/commands.rb:18:in `<top (required)>'
	from bin/rails:4:in `require'
	from bin/rails:4:in `<main>'