Skip to content

Parse last_modified time only if it is valid#426

Open
krishnasrinivas wants to merge 1 commit intofog:masterfrom
krishnasrinivas:patch-1
Open

Parse last_modified time only if it is valid#426
krishnasrinivas wants to merge 1 commit intofog:masterfrom
krishnasrinivas:patch-1

Conversation

@krishnasrinivas
Copy link

options = { max_keys: 1 }
directories.get(@key, options)

We are getting the following stack trace for the above code on Azure Blobstore (as the response does not return "last_modified" on directory entries)

Caused by TypeError: no implicit conversion of nil into String
from /var/vcap/data/packages/ruby-2.5.5-r0.10.0/0dfbbae801575a6b5c084eec5c0bfb4826a6e4be/lib/ruby/2.5.0/time.rb:367:in `_parse'



[13] pry(VCAP::CloudController)> VCAP::CloudController::ResourcePool.new(Config.config).blobstore.exists?('asdf')
/var/vcap/data/packages/ruby-2.5.5-r0.10.0/0dfbbae801575a6b5c084eec5c0bfb4826a6e4be/lib/ruby/2.5.0/time.rb:367:in `_parse'
/var/vcap/data/packages/ruby-2.5.5-r0.10.0/0dfbbae801575a6b5c084eec5c0bfb4826a6e4be/lib/ruby/2.5.0/time.rb:367:in `parse'
/var/vcap/data/packages/cloud_controller_ng/213aa19eb0f9e335047b2a81dc299e4f15ab6f30/cloud_controller_ng/vendor/cache/fog-azure-rm-baaf3f4d684f/lib/fog/azurerm/utilities/general.rb:157:in `parse_storage_object'
/var/vcap/data/packages/cloud_controller_ng/213aa19eb0f9e335047b2a81dc299e4f15ab6f30/cloud_controller_ng/vendor/cache/fog-azure-rm-baaf3f4d684f/lib/fog/azurerm/models/storage/directories.rb:55:in `block in get'
/var/vcap/data/packages/cloud_controller_ng/213aa19eb0f9e335047b2a81dc299e4f15ab6f30/cloud_controller_ng/vendor/cache/fog-azure-rm-baaf3f4d684f/lib/fog/azurerm/models/storage/directories.rb:54:in `each'
/var/vcap/data/packages/cloud_controller_ng/213aa19eb0f9e335047b2a81dc299e4f15ab6f30/cloud_controller_ng/vendor/cache/fog-azure-rm-baaf3f4d684f/lib/fog/azurerm/models/storage/directories.rb:54:in `get'
/var/vcap/data/packages/cloud_controller_ng/213aa19eb0f9e335047b2a81dc299e4f15ab6f30/cloud_controller_ng/lib/cloud_controller/blobstore/fog/directory.rb:16:in `get'

Here's the XML response:

<?xml version="1.0" encoding="utf-8"?><EnumerationResults ServiceEndpoint="https://leia.blob.core.windows.net/" ContainerName="resources"><MaxResults>1</MaxResults><Delimiter>/</Delimiter><Blobs><BlobPrefix><Name>app_bits_cache/</Name></BlobPrefix></Blobs><NextMarker /></EnumerationResults>

You can notice that there is no "last-modified" field.

I am not familiar with Ruby, hope this is the right way to fix this bug :-)

krishnasrinivas added a commit to krishnasrinivas/fog-azure-rm that referenced this pull request Feb 26, 2020
krishnasrinivas added a commit to krishnasrinivas/fog-azure-rm that referenced this pull request Feb 26, 2020
krishnasrinivas added a commit to krishnasrinivas/fog-azure-rm that referenced this pull request Feb 26, 2020
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 this pull request may close these issues.

1 participant

Comments