Bug 1211392 - evm:automate:export rake task broken when EXPORT_AS contains domain substring
Summary: evm:automate:export rake task broken when EXPORT_AS contains domain substring
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat CloudForms Management Engine
Classification: Red Hat
Component: Automate
Version: 5.3.0
Hardware: All
OS: All
unspecified
medium
Target Milestone: GA
: 5.4.0
Assignee: mkanoor
QA Contact: Milan Falešník
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2015-04-13 21:05 UTC by Josh Carter
Modified: 2019-07-11 08:56 UTC (History)
7 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
In the previous version of CloudForms Management Engine, when the EXPORT_AS domain was a substring of the source domain, it resulted in a broken export. This was due to EXPORT_AS was unable to handle names which start with the same string as the original name. With this release, EXPORT_AS has been fixed and the export now completes successfully.
Clone Of:
Environment:
Last Closed: 2015-06-16 12:58:02 UTC
Category: ---
Cloudforms Team: ---
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2015:1100 0 normal SHIPPED_LIVE CFME 5.4.0 bug fixes, and enhancement update 2015-06-16 16:28:42 UTC

Comment 1 Josh Carter 2015-04-13 21:08:56 UTC

/vmdb/app/models/miq_ae_yaml_export.rb
def write_domain_file(domain_obj)
    if @options['export_as'].present?
      saved_domain    = domain_obj.name
      domain_obj.name = @options['export_as']
    end
    envelope_hash = setup_envelope(domain_obj, DOMAIN_OBJ_TYPE).to_yaml
    write_export_file('fqname'          => swap_domain_name(domain_obj.name),
                      'output_filename' => DOMAIN_YAML_FILENAME,
                      'export_data'     => envelope_hash,
                      'created_on'      => domain_obj.created_on,
                      'updated_on'      => domain_obj.updated_on)
    domain_obj.name = saved_domain if saved_domain
  end



The following change to app/models/miq_ae_yaml_export.rb seems to fix the issue:

  def write_domain_file(domain_obj)
    #if @options['export_as'].present?
    #  saved_domain    = domain_obj.name
    #  domain_obj.name = @options['export_as']
    #end
    envelope_hash = setup_envelope(domain_obj, DOMAIN_OBJ_TYPE).to_yaml
    write_export_file('fqname'          => swap_domain_name(domain_obj.name),
                      'output_filename' => DOMAIN_YAML_FILENAME,
                      'export_data'     => envelope_hash,
                      'created_on'      => domain_obj.created_on,
                      'updated_on'      => domain_obj.updated_on)
    #domain_obj.name = saved_domain if saved_domain
  end

Comment 3 CFME Bot 2015-04-16 15:26:06 UTC
New commit detected on manageiq/master:
https://github.com/ManageIQ/manageiq/commit/9c6d3f9a2f69500b3496ea53ec56baaf30e0b319

commit 9c6d3f9a2f69500b3496ea53ec56baaf30e0b319
Author:     Madhu Kanoor <mkanoor>
AuthorDate: Wed Apr 15 10:05:44 2015 -0400
Commit:     Madhu Kanoor <mkanoor>
CommitDate: Wed Apr 15 10:05:44 2015 -0400

    Export as issues
    
    Export as could not handle names which start with the same string
    as the original name.
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1211392

 vmdb/app/models/miq_ae_yaml_export.rb              | 2 +-
 vmdb/spec/models/miq_ae_yaml_import_export_spec.rb | 3 ++-
 2 files changed, 3 insertions(+), 2 deletions(-)

Comment 5 Milan Falešník 2015-04-30 13:45:27 UTC
# rpm -qa cfme
cfme-5.4.0.0.24-1.el6cf.x86_64
# bin/rake evm:automate:export DOMAIN=aaa EXPORT_AS=aaaaaa
No export location specified. Exporting domain: aaa to: ./aaa.zip
# mv aaa.zip aaa1.zip
# bin/rake evm:automate:export DOMAIN=aaa EXPORT_AS=aa
No export location specified. Exporting domain: aaa to: ./aaa.zip
# mv aaa.zip aaa2.zip
# less aaa1.zip
Archive:  aaa1.zip
Zip file size: 3022 bytes, number of entries: 15
drwxr-xr-x  5.2 unx        0 t- defN 15-Apr-30 09:39 aaaaaa/
-rw-r--r--  5.2 unx     1189 t- defN 15-Apr-30 09:39 aaaaaa/.manifest.yaml
-rw-r--r--  5.2 unx      169 t- defN 15-Apr-30 09:39 aaaaaa/__domain__.yaml
drwxr-xr-x  5.2 unx        0 t- defN 15-Apr-30 09:39 aaaaaa/a/
-rw-r--r--  5.2 unx      154 t- defN 15-Apr-30 09:39 aaaaaa/a/__namespace__.yaml
drwxr-xr-x  5.2 unx        0 t- defN 15-Apr-30 09:39 aaaaaa/a/b/
-rw-r--r--  5.2 unx      154 t- defN 15-Apr-30 09:39 aaaaaa/a/b/__namespace__.yaml
drwxr-xr-x  5.2 unx        0 t- defN 15-Apr-30 09:39 aaaaaa/a/b/c/
-rw-r--r--  5.2 unx      154 t- defN 15-Apr-30 09:39 aaaaaa/a/b/c/__namespace__.yaml
drwxr-xr-x  5.2 unx        0 t- defN 15-Apr-30 09:39 aaaaaa/a/b/c/d/
-rw-r--r--  5.2 unx      154 t- defN 15-Apr-30 09:39 aaaaaa/a/b/c/d/__namespace__.yaml
drwxr-xr-x  5.2 unx        0 t- defN 15-Apr-30 09:39 aaaaaa/a/b/c/d/e/
-rw-r--r--  5.2 unx      154 t- defN 15-Apr-30 09:39 aaaaaa/a/b/c/d/e/__namespace__.yaml
drwxr-xr-x  5.2 unx        0 t- defN 15-Apr-30 09:39 aaaaaa/a/b/c/d/e/aasdf.class/
-rw-r--r--  5.2 unx      190 t- defN 15-Apr-30 09:39 aaaaaa/a/b/c/d/e/aasdf.class/__class__.yaml
15 files, 2318 bytes uncompressed, 1176 bytes compressed:  49.3%
# less aaa2.zip
Archive:  aaa2.zip
Zip file size: 2903 bytes, number of entries: 15
drwxr-xr-x  5.2 unx        0 t- defN 15-Apr-30 09:40 aa/
-rw-r--r--  5.2 unx     1189 t- defN 15-Apr-30 09:40 aa/.manifest.yaml
-rw-r--r--  5.2 unx      165 t- defN 15-Apr-30 09:40 aa/__domain__.yaml
drwxr-xr-x  5.2 unx        0 t- defN 15-Apr-30 09:40 aa/a/
-rw-r--r--  5.2 unx      154 t- defN 15-Apr-30 09:40 aa/a/__namespace__.yaml
drwxr-xr-x  5.2 unx        0 t- defN 15-Apr-30 09:40 aa/a/b/
-rw-r--r--  5.2 unx      154 t- defN 15-Apr-30 09:40 aa/a/b/__namespace__.yaml
drwxr-xr-x  5.2 unx        0 t- defN 15-Apr-30 09:40 aa/a/b/c/
-rw-r--r--  5.2 unx      154 t- defN 15-Apr-30 09:40 aa/a/b/c/__namespace__.yaml
drwxr-xr-x  5.2 unx        0 t- defN 15-Apr-30 09:40 aa/a/b/c/d/
-rw-r--r--  5.2 unx      154 t- defN 15-Apr-30 09:40 aa/a/b/c/d/__namespace__.yaml
drwxr-xr-x  5.2 unx        0 t- defN 15-Apr-30 09:40 aa/a/b/c/d/e/
-rw-r--r--  5.2 unx      154 t- defN 15-Apr-30 09:40 aa/a/b/c/d/e/__namespace__.yaml
drwxr-xr-x  5.2 unx        0 t- defN 15-Apr-30 09:40 aa/a/b/c/d/e/aasdf.class/
-rw-r--r--  5.2 unx      190 t- defN 15-Apr-30 09:40 aa/a/b/c/d/e/aasdf.class/__class__.yaml
15 files, 2314 bytes uncompressed, 1177 bytes compressed:  49.1%

Is this enough for proving that the fix works?

Comment 6 mkanoor 2015-05-07 13:59:14 UTC
Yes, that should be good enough

Comment 8 errata-xmlrpc 2015-06-16 12:58:02 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, 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://rhn.redhat.com/errata/RHBA-2015-1100.html


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