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

existing_remote_files = 'delete' on Rackspace Cloud Files #280

Open
ghost opened this issue Oct 17, 2014 · 1 comment
Open

existing_remote_files = 'delete' on Rackspace Cloud Files #280

ghost opened this issue Oct 17, 2014 · 1 comment

Comments

@ghost
Copy link

ghost commented Oct 17, 2014

Using asset_sync via middleman-sync, I found that no files are actually retrieved from the given bucket, so existing_remote_files = 'delete' flags no files for deletion.

Comparing lib/asset_sync/storage.rb with fog's delete_file.rb example, bucket.files should return 37 files in this container, but instead comes up empty in get_remote_files

I modified

% sed -n 98,107p ~/.gem/ruby/2.1.0/gems/asset_sync-1.0.0/lib/asset_sync/storage.rb ~/.gem/ruby/2.1.0/gems/asset_sync-1.0.0/lib/asset_sync/storage.rb

    def get_remote_files
      raise BucketNotFound.new("#{self.config.fog_provider} Bucket: #{self.config.fog_directory} not found.") unless bucket
      # fixes: https://github.com/rumblelabs/asset_sync/issues/16
      #        (work-around for https://github.com/fog/fog/issues/596)
      files = []
      ap bucket
      ap bucket.files
      bucket.files.each { |f| files << f.key }
      return files
    end

which shows that the Fog::Storage::Rackspace::Directory has 37 files (which it does), but ap bucket.files just prints the square brackets of an empty array.

% middleman sync

...snip...
Fetching files to flag for delete
  <Fog::Storage::Rackspace::Directory
    key="rstroxbucket",
    bytes=2093842,
    count=37,
    cdn_cname=nil
  >
[]
Flagging 0 file(s) for deletion
AssetSync: Done.
@ghost
Copy link
Author

ghost commented Oct 20, 2014

I found that setting :prefix in #18 caused this. Changing line 23 in lib/asset_sync/storage.rb to

@bucket ||= connection.directories.get(self.config.fog_directory)

fixed delete functionality for me. I'll keep looking for a better solution.

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

No branches or pull requests

0 participants