Bug 1012308

Summary: horizon: upload to swift from cli shows directories
Product: Red Hat OpenStack Reporter: Dafna Ron <dron>
Component: python-django-horizonAssignee: Julie Pichon <jpichon>
Status: CLOSED NOTABUG QA Contact: Ami Jeain <ajeain>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 4.0CC: aortega, athomas, hateya, jpichon, mrunge, yeylon
Target Milestone: ---   
Target Release: 4.0   
Hardware: x86_64   
OS: Linux   
Whiteboard: storage
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-10-23 15:32:45 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description Dafna Ron 2013-09-26 09:05:34 UTC
Description of problem:

there are some differences between how we see files that are uploaded from horizon and files uploaded from the cli.

if I upload a file from horizon I will just see the file name (i.e upload -> select a dir -> select a file)
if I upload a file from cli, if I specify a directory (i.e /tmp) than horizon will show the entire path
if I upload a file from cli without specifying a directory (i.e cd /tmp swift upload <container> <file>) I see just the file.

I think that there should be consistency between horizon and cli.
also, if you use a linux command like scp for example, the original path is not relevant so I do not think that we should be seeing that in swift as well.

Version-Release number of selected component (if applicable):

python-django-horizon-2013.2-0.12b3.el6ost.noarch

How reproducible:

100%

Steps to Reproduce:
1. upload a file from horizon
2. upload a file from cli: swift upload <container> <file>
3. upload a file from cli: swift upload <container> </tmp/file>

Actual results:

in horizon, the file that was given a path will show the directory under the container

Expected results:

we should not show the path 

Additional info:

https://bugs.launchpad.net/horizon/+bug/1231331

Comment 1 Dafna Ron 2013-09-26 09:17:50 UTC
also, if we try to remove the directory from horizon:

Error: You do not have permission to delete object: tmp

while cli will give:

[root@nott-vdsa ~(keystone_admin)]# swift delete dafna tmp
Object 'dafna/tmp' not found
[root@nott-vdsa ~(keystone_admin)]# swift list dafna
tmp/ks-script-uLSgyo.log
[root@nott-vdsa ~(keystone_admin)]#

Comment 2 Julie Pichon 2013-10-23 15:32:45 UTC
IMO, the behaviour is consistent between both:

Via Horizon:
1. Upload file "test" with name "test" -> a test file is shown at the top level
2. Upload file test with name "tmp/test" -> a test file is created within a "tmp" directory (actually pseudo-folder)

Via Swift CLI:
1. swift upload test -> a test file is shown at the top level
2. swift upload tmp/test -> the test file and tmp directory (actually pseudo-folder) are uploaded

This is the way Swift works: http://docs.openstack.org/api/openstack-object-storage/1.0/content/folders-directories.html . To navigate the pseudo-folders you'd then use the 'delimiter' option together with 'list':

$ swift list test
test/test_within_test
tmp/test_within_test
tmp/tmp_file

$ swift list test -d /
test/
tmp/

This is the spec that Horizon follows.

I think it would be better to file a bug about the error message discrepancy mentioned in comment 1 separately, if you don't mind filing another bug. I think Horizon could do better and ideally explain why it can't be deleted. Thanks!