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

miqimport service_dialogs fails for CFME 5.10 #148

Open
A-Beck opened this issue Nov 5, 2019 · 5 comments
Open

miqimport service_dialogs fails for CFME 5.10 #148

A-Beck opened this issue Nov 5, 2019 · 5 comments

Comments

@A-Beck
Copy link

A-Beck commented Nov 5, 2019

I am seeing the following error when importing service dialogs in cfme 5.10 / CloudForms 4.7:

rake aborted!
ServiceDialogImportExport::ParsedNonDialogYamlError: ServiceDialogImportExport::ParsedNonDialogYamlError
/var/www/miq/vmdb/lib/tasks/rhconsulting_service_dialogs.rake:89:in `rescue in import_dialogs'
/var/www/miq/vmdb/lib/tasks/rhconsulting_service_dialogs.rake:74:in `import_dialogs'
/var/www/miq/vmdb/lib/tasks/rhconsulting_service_dialogs.rake:40:in `import_dialogs_from_file'
/var/www/miq/vmdb/lib/tasks/rhconsulting_service_dialogs.rake:30:in `block (2 levels) in import'
/var/www/miq/vmdb/lib/tasks/rhconsulting_service_dialogs.rake:28:in `foreach'
/var/www/miq/vmdb/lib/tasks/rhconsulting_service_dialogs.rake:28:in `block in import'
/opt/rh/cfme-gemset/gems/activerecord-5.0.7.2/lib/active_record/connection_adapters/abstract/database_statements.rb:232:in `block in transaction'
/opt/rh/cfme-gemset/gems/activerecord-5.0.7.2/lib/active_record/connection_adapters/abstract/transaction.rb:189:in `within_new_transaction'
/opt/rh/cfme-gemset/gems/activerecord-5.0.7.2/lib/active_record/connection_adapters/abstract/database_statements.rb:232:in `transaction'
/opt/rh/cfme-gemset/gems/activerecord-5.0.7.2/lib/active_record/transactions.rb:211:in `transaction'
/var/www/miq/vmdb/lib/tasks/rhconsulting_service_dialogs.rake:27:in `import'
/var/www/miq/vmdb/lib/tasks/rhconsulting_service_dialogs.rake:203:in `block (3 levels) in <top (required)>'

Caused by:
NoMethodError: undefined method `circular_references' for #<DialogFieldAssociationValidator:0x0000000002477460>
/var/www/miq/vmdb/lib/tasks/rhconsulting_service_dialogs.rake:58:in `check_field_associations'
/var/www/miq/vmdb/lib/tasks/rhconsulting_service_dialogs.rake:106:in `import_dialog_fields'
/var/www/miq/vmdb/lib/tasks/rhconsulting_service_dialogs.rake:101:in `block in import_dialog_groups'
/var/www/miq/vmdb/lib/tasks/rhconsulting_service_dialogs.rake:100:in `collect'
/var/www/miq/vmdb/lib/tasks/rhconsulting_service_dialogs.rake:100:in `import_dialog_groups'
/var/www/miq/vmdb/lib/tasks/rhconsulting_service_dialogs.rake:95:in `block in import_dialog_tabs'
/var/www/miq/vmdb/lib/tasks/rhconsulting_service_dialogs.rake:94:in `collect'
/var/www/miq/vmdb/lib/tasks/rhconsulting_service_dialogs.rake:94:in `import_dialog_tabs'
/var/www/miq/vmdb/lib/tasks/rhconsulting_service_dialogs.rake:82:in `block in import_dialogs'
/var/www/miq/vmdb/lib/tasks/rhconsulting_service_dialogs.rake:76:in `each'
/var/www/miq/vmdb/lib/tasks/rhconsulting_service_dialogs.rake:76:in `import_dialogs'
/var/www/miq/vmdb/lib/tasks/rhconsulting_service_dialogs.rake:40:in `import_dialogs_from_file'
/var/www/miq/vmdb/lib/tasks/rhconsulting_service_dialogs.rake:30:in `block (2 levels) in import'
/var/www/miq/vmdb/lib/tasks/rhconsulting_service_dialogs.rake:28:in `foreach'
/var/www/miq/vmdb/lib/tasks/rhconsulting_service_dialogs.rake:28:in `block in import'
/opt/rh/cfme-gemset/gems/activerecord-5.0.7.2/lib/active_record/connection_adapters/abstract/database_statements.rb:232:in `block in transaction'
/opt/rh/cfme-gemset/gems/activerecord-5.0.7.2/lib/active_record/connection_adapters/abstract/transaction.rb:189:in `within_new_transaction'
/opt/rh/cfme-gemset/gems/activerecord-5.0.7.2/lib/active_record/connection_adapters/abstract/database_statements.rb:232:in `transaction'
/opt/rh/cfme-gemset/gems/activerecord-5.0.7.2/lib/active_record/transactions.rb:211:in `transaction'
/var/www/miq/vmdb/lib/tasks/rhconsulting_service_dialogs.rake:27:in `import'
/var/www/miq/vmdb/lib/tasks/rhconsulting_service_dialogs.rake:203:in `block (3 levels) in <top (required)>'
Tasks: TOP => rhconsulting:service_dialogs:import
(See full trace by running task with --trace)

This seems to occur because the method has been updated from circular_references to check_for_circular_references in 5.10:

[root@cfme0001 ~]# cat /var/www/miq/vmdb/app/models/dialog_field_association_validator.rb
class DialogFieldAssociationValidator
  class DialogFieldAssociationCircularReferenceError < RuntimeError; end
  def check_for_circular_references(hash, k, collection = [])
    raise DialogFieldAssociationCircularReferenceError, "#{k} already exists in #{collection}" if collection.include?(k)
    collection << k
    hash[k]&.each do |val|
      check_for_circular_references(hash, val, collection.dup)
    end
    nil
  end
end

This one line fixed allowed me to import, but is logically incorrect:

# change here: https://github.com/rhtconsulting/cfme-rhconsulting-scripts/blob/master/rhconsulting_service_dialogs.rake#L57
>     raise DialogFieldAssociationCircularReferenceError if dialog_field_association_validator.circular_references(associations)
<     raise DialogFieldAssociationCircularReferenceError if dialog_field_association_validator.check_for_circular_references(associations, nil)
@borisko123
Copy link

Also has this issue.
simply comment the call to this method meanwhile.
I see no one is interested to fix this.
BTW, I see the rake tasks doing the import/export are built-in in CFME .
Do you have some experience using them? May them replace the rhconsulting scripts?
It seems the rhconsulting scripts are abandoned for years.

@branic
Copy link
Contributor

branic commented Feb 3, 2020

The rake scripts built into MIQ/CFME do supersede and replace the scripts in this repo.

The tracking issue for bringing these scripts into MIQ is ManageIQ/manageiq#15350

@borisko123
Copy link

Thanks for prompt answer
Does this mean that rhconsult scripts are deprecated?
I should say the rhconsults scripts are very good and have awesome cli interface.
The builtin scripts seems less convinient....

@branic
Copy link
Contributor

branic commented Feb 3, 2020

Yes, the rhconsult scripts are deprecated.

They were so widely used that the MIQ project asked that they be added to the main product. There were some changes (like the rake task naming) that were needed, but the functionality is the same.

The shell scripts (miqimport/miqexport) that call the rake tasks are not included in MIQ/CFME, but could easily be created by users if desired.

@borisko123
Copy link

borisko123 commented Feb 3, 2020 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants