Bug 1753586 - Imported System Domains can not be deleted in CloudForms
Summary: Imported System Domains can not be deleted in CloudForms
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat CloudForms Management Engine
Classification: Red Hat
Component: Automate
Version: 5.10.5
Hardware: Unspecified
OS: Unspecified
high
medium
Target Milestone: GA
: 5.11.7
Assignee: Patrik Kománek
QA Contact: Devidas Gaikwad
Red Hat CloudForms Documentation
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2019-09-19 11:09 UTC by Khushbu Borole
Modified: 2022-07-09 11:29 UTC (History)
10 users (show)

Fixed In Version: 5.11.7.0
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2020-08-06 14:32:52 UTC
Category: Bug
Cloudforms Team: CFME Core
Target Upstream Version:
Embargoed:
simaishi: cfme-5.11.z+


Attachments (Terms of Use)
Adding screenshot of verification (46.13 KB, image/png)
2020-07-16 09:12 UTC, Devidas Gaikwad
no flags Details


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2020:3358 0 None None None 2020-08-06 14:33:04 UTC

Description Khushbu Borole 2019-09-19 11:09:34 UTC
Description of problem:
Importing the 'Core Domains' with a different name creates a new Core Domain which should not be permitted as Red Hat CloudForms have only two Core Domain i.e RedHat and ManageIQ

Version-Release number of selected component (if applicable):
Red Hat CloudForms 4.7

How reproducible:
Always with the below steps.

Steps to Reproduce:
1 Export the appliance domain as a zip file
2 Extracted the ManageIQ directory to a new dir on the local machine called Domain_Test02
3 From within the new Domain_Test02 dir, edit the __domain__.yaml file so that the 'name' attribute equals Domain_Test02
NOTE: Do not change the 'source' attribute from 'system' to 'user' this time.
4 Archived the new Domain_Test02 dir and upload to CloudForms Appliance

Actual results:
The imported domain is a New Core Domian like RedHat and ManageIQ domain those can not be deleted and edited.
The new domain behaviour is similar to Core Domains

Expected results:
The imported domains should be Custom Domains
Is there any other way to forcefully delete the Core/Base Domain ?

Additional info:
- Modifying the `Source = user` attribute in the yaml file and re-importing everything but 'Domain_Test02' is still marked as locked.
- Editing the __domain__.yaml before importing to `Source = user` creates no problem

Comment 3 Ganesh Hubale 2019-09-19 13:41:48 UTC
Hi Khushbu,

>> Is there any other way to forcefully delete the Core/Base Domain ?

We can delete locked domains via rails:
ssh to appliance and perform:

[root@vm253-117 vmdb]# bin/rails c
irb(main):001:0> MiqAeDomain.first (check output this command and see if you want to delete that domain or try second, third etc options to get particular domain)
irb(main):002:0> MiqAeDomain.first.delete

[root@vm253-117 vmdb]# bin/rake evm:automate:reset
Resetting the default domains in the automation model
The default domains in the automation model have been reset.

Please let me know, if it works or not.

Thanks,
Ganesh

Comment 4 Khushbu Borole 2019-09-19 14:11:45 UTC
Hello Ganesh,

Thank you so much for the prompt reply.

This works and I have updated the CU about the same.
Thank you so very much !!

Regards,
Khushbu

Comment 7 Tina Fitzgerald 2019-09-30 19:01:27 UTC
Hi Khushbu,

Can you write a KB article to explain how to manually delete a 'system' domain added by mistake, and can we close this ticket?

Let me know if you have any questions.

Thanks,
Tina

Comment 9 Tina Fitzgerald 2019-10-07 20:44:36 UTC
Hi Patrik,

Can you investigate how difficult it would be to issue a warning message if the domain being imported is a 'system' domain?

Thanks,
Tina

Comment 11 Tina Fitzgerald 2019-10-24 19:13:00 UTC
Hi Patrik,

As we discussed earlier this week, we should prevent a system domain (other than our system domains) from being imported.
Can you look into the code that is used to "Reset all components in the following domains: RedHat, ManageIQ" to determine if the system domain is ours?

Let me know if you have any questions.

Thanks,
Tina

Comment 12 Patrik Kománek 2019-11-08 14:30:44 UTC
Hi Tina. This is the logic you were asking for: https://github.com/ManageIQ/manageiq-automation_engine/blob/master/app/models/miq_ae_datastore.rb#L176-L209. So if you add some new system domain, it wont be added into the result of `MiqAeDatastore.default_domain_names` method. I am not sure what is the best way here. We can validate the imported domains by name and keep system domain import only for domains with name from `MiqAeDatastore.default_domain_names`. Is this validation enough? What do you think?

Comment 13 Tina Fitzgerald 2019-11-08 19:52:59 UTC
Hi Patrik,

Yes, checking the domain name against MiqAeDatastore.default_domain_names is validation enough when trying to import a system domain.

Let me know if you have any questions.

Thanks,
Tina

Comment 14 Patrik Kománek 2020-01-06 14:42:26 UTC
solved in https://github.com/ManageIQ/manageiq-automation_engine/pull/395.

Comment 15 CFME Bot 2020-07-02 18:06:13 UTC
New commit detected on ManageIQ/manageiq-automation_engine/ivanchuk:

https://github.com/ManageIQ/manageiq-automation_engine/commit/2fe6402c889b028e532c439a03d2e3e6859e1449
commit 2fe6402c889b028e532c439a03d2e3e6859e1449
Author:     tina <tfitzger>
AuthorDate: Wed Dec 18 16:19:57 2019 +0000
Commit:     Satoe Imaishi <simaishi>
CommitDate: Thu Jul  2 17:34:37 2020 +0000

    Merge pull request #395 from pkomanek/reworking_automate_datastore_import_validation

    Changing the automate datastore import validation.

    (cherry picked from commit 8c1497c4142656643340cd0f1ec2b7232b24bda3)

    https://bugzilla.redhat.com/show_bug.cgi?id=1753586

 app/models/miq_ae_git_import.rb | 5 +-
 app/models/miq_ae_yaml_import.rb | 29 +-
 spec/models/miq_ae_git_import_spec.rb | 2 +-
 spec/models/miq_ae_yaml_import_spec.rb | 133 +-
 4 files changed, 162 insertions(+), 7 deletions(-)

Comment 16 CFME Bot 2020-07-02 18:10:53 UTC
New commit detected on ManageIQ/manageiq-ui-classic/ivanchuk:

https://github.com/ManageIQ/manageiq-ui-classic/commit/75d94a0adb8c7be8568325fde15aef1d42c93b1e
commit 75d94a0adb8c7be8568325fde15aef1d42c93b1e
Author:     Martin Povolny <mpovolny>
AuthorDate: Fri Jan 10 09:10:34 2020 +0000
Commit:     Satoe Imaishi <simaishi>
CommitDate: Thu Jul  2 17:42:38 2020 +0000

    Merge pull request #6434 from pkomanek/refactoring_automate_import_error_messages

    Refactoring automate import error messages.

    (cherry picked from commit 298b657bb0827fc8c72eec8bd47e9b0be6e09da1)

    https://bugzilla.redhat.com/show_bug.cgi?id=1753586

 app/controllers/miq_ae_tools_controller.rb | 6 +-
 app/services/git_based_domain_import_service.rb | 12 +-
 spec/controllers/miq_ae_tools_controller_spec.rb | 4 +-
 spec/services/git_based_domain_import_service_spec.rb | 8 +-
 4 files changed, 11 insertions(+), 19 deletions(-)

Comment 17 Satoe Imaishi 2020-07-02 18:12:35 UTC
After discussing with Tina, I've also backported https://github.com/ManageIQ/manageiq-automation_engine/pull/355 as a PR needed for this BZ depends on it. When testing this BZ, please make sure PR355 is also tested. Thank you!

Comment 18 Devidas Gaikwad 2020-07-16 09:09:19 UTC
Verified on 5.11.7.0.20200714215453_0da8a4a

Performed below steps to Verification:
- Exported domain by navigating Automation>Automate>(Import/Export)
- On completion of downloading, untar fail and edited ManageIQ domain by changing name
- made zip file only for ManageIQ domain by giving on_qa-zip 
- upload on-qa.zip file by navigating Automation>Automate>(Import/Export)
- Once upload done selected all available namespaces and clicked on commit button.

After performing all above steps got expected error that is system domain is not supported.

Comment 19 Devidas Gaikwad 2020-07-16 09:12:21 UTC
Created attachment 1701350 [details]
Adding screenshot of verification

Comment 22 errata-xmlrpc 2020-08-06 14:32:52 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (Critical: CloudForms 5.0.7 bug fix and enhancement update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2020:3358


Note You need to log in before you can comment on or make changes to this bug.