# File lib/fog/hp/models/storage/directory.rb, line 125 def save requires :key options = {} if @acl options.merge!(service.acl_to_header(@acl)) end service.put_container(key, options) # Added an extra check to see if CDN is enabled for the container if (!service.cdn.nil? && service.cdn.enabled?) # If CDN available, set the container to be CDN-enabled or not based on if it is marked as cdn_enable. if @cdn_enable # check to make sure that the container exists. If yes, cdn enable it. begin response = service.cdn.head_container(key) ### Deleting a container from CDN is much more expensive than flipping the bit to disable it service.cdn.post_container(key, {'X-CDN-Enabled' => 'True'}) rescue Fog::CDN::HP::NotFound => err service.cdn.put_container(key) end else # check to make sure that the container exists. If yes, cdn disable it. begin response = service.cdn.head_container(key) ### Deleting a container from CDN is much more expensive than flipping the bit to disable it service.cdn.post_container(key, {'X-CDN-Enabled' => 'False'}) rescue Fog::CDN::HP::NotFound => err # just continue, as container is not cdn-enabled. end end end true end