Bug 1190812 - Log collection - FTP Error 550 'Create directory operation failed'
Summary: Log collection - FTP Error 550 'Create directory operation failed'
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat CloudForms Management Engine
Classification: Red Hat
Component: Appliance
Version: 5.3.0
Hardware: Unspecified
OS: Unspecified
medium
high
Target Milestone: GA
: 5.3.3
Assignee: Joe Rafaniello
QA Contact: Jan Krocil
URL:
Whiteboard:
Depends On: 1184465
Blocks:
TreeView+ depends on / blocked
 
Reported: 2015-02-09 16:35 UTC by Joe Rafaniello
Modified: 2015-03-23 16:21 UTC (History)
9 users (show)

Fixed In Version: 5.3.3
Doc Type: Bug Fix
Doc Text:
Clone Of: 1184465
Environment:
Last Closed: 2015-02-25 16:13:01 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:0261 0 normal SHIPPED_LIVE cfme (5.3.3) bug fix and enhancement update 2015-02-25 21:09:28 UTC

Comment 1 Joe Rafaniello 2015-02-09 16:47:50 UTC
5.3.z commits:

2c8fb4b Update tests to reflect the intermediate directory creation.
a4c1f87 Update FileDepotFtpAnonymous to match changes to FileDepotFtp.
05d6825 Rewrite file/directory existence and upload mechanisms.
a222a41 Change base_path and destination_path to return Pathnames.
91e662c Expose @ftp as an attr_reader so we don't need to pass it around.
0513e87 Refactor log_header into a method

Comment 4 Joe Rafaniello 2015-02-12 15:08:11 UTC
Jan, can you post the full log?  It appears like the code thinks the current logs are already posted but we're not logging it.

Can you try modifying the code to log when the file already exists?

Basically here:
https://github.com/ManageIQ/manageiq/blob/d94823188f4e3a83b0250ea9929fdd6226580d3c/vmdb/app/models/file_depot_ftp.rb#L23

Change:
  return if file_exists?(destination_file)

To:
  if file_exists?(destination_file)
    $log.warn("XXX File already exists: #{destination_file})
    return
  end
   

Is that what is happening?

Comment 6 Joe Rafaniello 2015-02-12 22:04:05 UTC
Upstream pull request: https://github.com/ManageIQ/manageiq/pull/1677

Net::FTP#nlst returns an array, so check for empty. 
Some ftp servers return an error when you ask for nlst on a missing file/directory.
Others, will return normally with an empty list.

We had tested with an ftp that does the error situation.
This commit fixes the "empty list" situation.

Comment 7 Joe Rafaniello 2015-02-12 22:15:56 UTC
Hi Jan,

If you could confirm that changing this single line:

From:
!!ftp.nlst(file_or_directory.to_s)


To:
!ftp.nlst(file_or_directory.to_s).empty?

(see https://github.com/jrafanie/manageiq/commit/7806260dda49949fb6dee9a8f833529bf262412e)

I was able to recreate the issue on a different ftp server so I'm pretty confident it will fix it.

Thanks!

Comment 8 Jan Krocil 2015-02-13 12:07:41 UTC
Hey Joe,
yes, this change indeed fixed the issue for me.

Comment 9 CFME Bot 2015-02-13 14:35:42 UTC
New commit detected on manageiq/master:
https://github.com/ManageIQ/manageiq/commit/230872902234a8057f7d95fa763cede79966f809

commit 230872902234a8057f7d95fa763cede79966f809
Author:     Joe Rafaniello <jrafanie>
AuthorDate: Thu Feb 12 16:49:20 2015 -0500
Commit:     Joe Rafaniello <jrafanie>
CommitDate: Thu Feb 12 16:50:31 2015 -0500

    For testing, add ftp setter and mark file_exists? as public
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1190812

 vmdb/app/models/file_depot_ftp.rb | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

Comment 10 CFME Bot 2015-02-13 14:35:46 UTC
New commit detected on manageiq/master:
https://github.com/ManageIQ/manageiq/commit/7806260dda49949fb6dee9a8f833529bf262412e

commit 7806260dda49949fb6dee9a8f833529bf262412e
Author:     Joe Rafaniello <jrafanie>
AuthorDate: Thu Feb 12 16:56:24 2015 -0500
Commit:     Joe Rafaniello <jrafanie>
CommitDate: Thu Feb 12 16:56:24 2015 -0500

    Net::FTP#nlst returns an array, so check for empty.
    
    Some ftp servers return an error when you ask for nlst on a missing file/directory.
    Others, will return normally with an empty list.
    
    We had tested with an ftp that does the error situation.
    This commit fixes the "empty list" situation.
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1190812

 vmdb/app/models/file_depot_ftp.rb       |  2 +-
 vmdb/spec/models/file_depot_ftp_spec.rb | 21 +++++++++++++++++++++
 2 files changed, 22 insertions(+), 1 deletion(-)

Comment 11 CFME Bot 2015-02-13 15:05:43 UTC
New commit detected on cfme/5.3.z:
https://code.engineering.redhat.com/gerrit/gitweb?p=cfme.git;a=commitdiff;h=b765dc9dad6e77079fdad75dbc34c73ffff2c290

commit b765dc9dad6e77079fdad75dbc34c73ffff2c290
Author:     Joe Rafaniello <jrafanie>
AuthorDate: Thu Feb 12 16:49:20 2015 -0500
Commit:     Joe Rafaniello <jrafanie>
CommitDate: Fri Feb 13 10:00:44 2015 -0500

    For testing, add ftp setter and mark file_exists? as public
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1190812

 vmdb/app/models/file_depot_ftp.rb | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

Comment 12 CFME Bot 2015-02-13 15:05:46 UTC
New commit detected on cfme/5.3.z:
https://code.engineering.redhat.com/gerrit/gitweb?p=cfme.git;a=commitdiff;h=c0ac477beb150862907cd43eebdff34c9b78f843

commit c0ac477beb150862907cd43eebdff34c9b78f843
Author:     Joe Rafaniello <jrafanie>
AuthorDate: Thu Feb 12 16:56:24 2015 -0500
Commit:     Joe Rafaniello <jrafanie>
CommitDate: Fri Feb 13 10:00:44 2015 -0500

    Net::FTP#nlst returns an array, so check for empty.
    
    Some ftp servers return an error when you ask for nlst on a missing file/directory.
    Others, will return normally with an empty list.
    
    We had tested with an ftp that does the error situation.
    This commit fixes the "empty list" situation.
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1190812

 vmdb/app/models/file_depot_ftp.rb       |  2 +-
 vmdb/spec/models/file_depot_ftp_spec.rb | 21 +++++++++++++++++++++
 2 files changed, 22 insertions(+), 1 deletion(-)

Comment 13 John Prause 2015-02-17 15:41:49 UTC
Joe: Can you cherry-pick this to 5.3.3,..DaJo gave the okay,.and the 5.3.3. branch is open.

Comment 14 CFME Bot 2015-02-17 16:10:39 UTC
New commit detected on cfme/5.3.3:
https://code.engineering.redhat.com/gerrit/gitweb?p=cfme.git;a=commitdiff;h=8075a1c6e96169b2189eeb9600f56f4760136826

commit 8075a1c6e96169b2189eeb9600f56f4760136826
Author:     Joe Rafaniello <jrafanie>
AuthorDate: Thu Feb 12 16:49:20 2015 -0500
Commit:     Joe Rafaniello <jrafanie>
CommitDate: Tue Feb 17 11:05:03 2015 -0500

    For testing, add ftp setter and mark file_exists? as public
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1190812

 vmdb/app/models/file_depot_ftp.rb | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

Comment 15 CFME Bot 2015-02-17 16:10:42 UTC
New commit detected on cfme/5.3.3:
https://code.engineering.redhat.com/gerrit/gitweb?p=cfme.git;a=commitdiff;h=09bf38c6ac21888cba5b58a2fab28e34792bfdcf

commit 09bf38c6ac21888cba5b58a2fab28e34792bfdcf
Author:     Joe Rafaniello <jrafanie>
AuthorDate: Thu Feb 12 16:56:24 2015 -0500
Commit:     Joe Rafaniello <jrafanie>
CommitDate: Tue Feb 17 11:05:08 2015 -0500

    Net::FTP#nlst returns an array, so check for empty.
    
    Some ftp servers return an error when you ask for nlst on a missing file/directory.
    Others, will return normally with an empty list.
    
    We had tested with an ftp that does the error situation.
    This commit fixes the "empty list" situation.
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1190812

 vmdb/app/models/file_depot_ftp.rb       |  2 +-
 vmdb/spec/models/file_depot_ftp_spec.rb | 21 +++++++++++++++++++++
 2 files changed, 22 insertions(+), 1 deletion(-)

Comment 16 Jan Krocil 2015-02-23 16:28:18 UTC
Verified - fixed in 5.3.3.2 (5.3.3.2.20150217120931_a465215).

Log collection using FTP now works as expected.

Comment 18 errata-xmlrpc 2015-02-25 16:13:01 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-0261.html


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