evm:automate:export rake task broken when EXPORT_AS contains domain substring
Issue
- When using EXPORT_AS with the evm:automate:export task, the domain file has swap_domain_name() run twice. When the EXPORT_AS domain is a substring of the source domain, this results in a broken export (zip file in this case). For example:
216 04-13-2015 15:01 EXAMPLE/System/Request.class/winrm_cmd.yaml
230 04-13-2015 15:01 EXAMPLE/System/Request.class/winrm_powershell.yaml
158 04-13-2015 15:01 EXAMPLE/System/__namespace__.yaml
0 04-13-2015 15:01 EXAMPLEEXAMPLE/
176 04-13-2015 15:01 EXAMPLEEXAMPLE/__domain__.yaml
- The backtrace where it happens:
[root@cfme vmdb]# bin/rake evm:automate:export DOMAIN= EXAMPLE EXPORT_AS= EXAMPLETEST
No export location specified. Exporting domain: EXAMPLE to: ./ EXAMPLE.zip
In swap_domain_name
Incoming fqname= EXAMPLETEST
Outgoing name= EXAMPLETESTTEST
/var/www/miq/vmdb/app/models/miq_ae_yaml_export.rb:265:in `swap_domain_name'
/var/www/miq/vmdb/app/models/miq_ae_yaml_export.rb:85:in `write_domain_file'
/var/www/miq/vmdb/app/models/miq_ae_yaml_export.rb:41:in `write_domain'
/var/www/miq/vmdb/app/models/miq_ae_yaml_export.rb:24:in `write_model'
/var/www/miq/vmdb/app/models/miq_ae_yaml_export_zipfs.rb:25:in `block in export'
/opt/rh/ruby193/root/usr/share/gems/gems/rubyzip-0.9.5/lib/zip/zip_file.rb:86:in `open'
/var/www/miq/vmdb/app/models/miq_ae_yaml_export_zipfs.rb:23:in `export'
/var/www/miq/vmdb/lib/tasks/evm_automate.rake:117:in `block (3 levels) in <top (required)>'
Environment
- Red Hat CloudForms 3.1
Subscriber exclusive content
A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.
Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.
