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

mock directories.create destroys existing directory #172

Closed
plribeiro3000 opened this issue Aug 21, 2015 · 2 comments · Fixed by #174
Closed

mock directories.create destroys existing directory #172

plribeiro3000 opened this issue Aug 21, 2015 · 2 comments · Fixed by #174

Comments

@plribeiro3000
Copy link
Member

When using Fog.mock!, calling directories.create(key: 'foo') appears to destroy any existing directory with that key. Is this intended behavior? Am I doing something wrong in my example?

irb(main):001:0> Fog.mock!
=> true
irb(main):002:0> c = Fog::Storage.new({provider: 'AWS', aws_access_key_id: '', aws_secret_access_key: ''})
=> #<Fog::Storage::AWS::Mock:0x007fcdb3db7030 @use_iam_profile=nil, @region="us-east-1", @endpoint=nil, @host="s3.amazonaws.com", @scheme="https", @port=443, @path_style=false, @signature_version=4, @aws_access_key_id="", @aws_secret_access_key="", @aws_session_token=nil, @aws_credentials_expire_at=nil, @signer=#<Fog::AWS::SignatureV4:0x007fcdb3d9f8b8 @region="us-east-1", @service="s3", @aws_access_key_id="", @hmac=#<Fog::HMAC:0x007fcdb3d9f818 @key="AWS4", @digest=#<OpenSSL::Digest: e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855>, @signer=#<Proc:0x007fcdb3d9f778@/Users/rsilva/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/fog-core-1.32.1/lib/fog/core/hmac.rb:28 (lambda)>>>>
irb(main):003:0> bucket = c.directories.create(key: 'bucket')
=>   <Fog::Storage::AWS::Directory
    key="bucket",
    creation_date=nil,
    location="us-east-1"
  >
irb(main):004:0> bucket.files.create(key: 'key', body: 'body')
=>   <Fog::Storage::AWS::File
    key="key",
    cache_control=nil,
    content_disposition=nil,
    content_encoding=nil,
    content_length=4,
    content_md5=nil,
    content_type=nil,
    etag="841a2d689ad86bd1611447453c22c6fc",
    expires=nil,
    last_modified="Thu, 20 Aug 2015 22:56:43 +0000",
    metadata={},
    owner=nil,
    storage_class=nil,
    encryption=nil,
    encryption_key=nil,
    version=nil
  >
irb(main):005:0> bucket.files.get('key')
=>   <Fog::Storage::AWS::File
    key="key",
    cache_control=nil,
    content_disposition=nil,
    content_encoding=nil,
    content_length=4,
    content_md5=nil,
    content_type=nil,
    etag="841a2d689ad86bd1611447453c22c6fc",
    expires=nil,
    last_modified=2015-08-20 15:56:43 -0700,
    metadata={},
    owner=nil,
    storage_class=nil,
    encryption=nil,
    encryption_key=nil,
    version=nil
  >
irb(main):006:0> c.directories.create(key: 'bucket')
=>   <Fog::Storage::AWS::Directory
    key="bucket",
    creation_date=nil,
    location="us-east-1"
  >
irb(main):007:0> bucket.files.get('key')
=> nil

Original issue opened by @russellsilva at fog/fog#3668.

@geemus
Copy link
Member

geemus commented Aug 21, 2015

Seems quite likely to just be a mistake in implementation (and likely one that wouldn't be too difficult to fix if somebody would like to try it). Just let me know if you do and need some guidance. Thanks!

@russellsilva
Copy link

Thanks!

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

Successfully merging a pull request may close this issue.

3 participants