Merge pull request #2997 from betagouv/frederic/fix_2180-active_storage_openstack

MAJ fog-openstack et ajout de activestorage-openstack
This commit is contained in:
Frederic Merizen 2018-11-16 11:37:16 +01:00 committed by GitHub
commit b5487141b7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 60 additions and 175 deletions

View file

@ -55,8 +55,8 @@ gem 'clamav-client', require: 'clamav/client'
gem 'carrierwave'
gem 'carrierwave-i18n'
gem 'copy_carrierwave_file'
gem 'fog'
gem 'fog-openstack'
gem 'activestorage-openstack', git: 'https://github.com/fredZen/activestorage-openstack.git', branch: 'frederic/bump-fog-openstack'
gem 'pg'

View file

@ -1,3 +1,14 @@
GIT
remote: https://github.com/fredZen/activestorage-openstack.git
revision: 8b64c113223e9ec431b220c9350866c4147b88c3
branch: frederic/bump-fog-openstack
specs:
activestorage-openstack (0.5.0)
fog-openstack (~> 1.0)
marcel
mime-types
rails (~> 5.2.0)
GIT
remote: https://github.com/hassox/warden.git
revision: 5b3cbd5bef67cbe399bb7007537bc4841bbee772
@ -17,7 +28,6 @@ GIT
GEM
remote: https://rubygems.org/
specs:
CFPropertyList (2.3.6)
aasm (5.0.1)
concurrent-ruby (~> 1.0)
actioncable (5.2.1)
@ -129,12 +139,10 @@ GEM
capybara-selenium (0.0.6)
capybara
selenium-webdriver
carrierwave (0.11.2)
activemodel (>= 3.2.0)
activesupport (>= 3.2.0)
json (>= 1.7)
carrierwave (1.2.3)
activemodel (>= 4.0.0)
activesupport (>= 4.0.0)
mime-types (>= 1.16)
mimemagic (>= 0.3.0)
carrierwave-i18n (0.2.0)
case_transform (0.2)
activesupport
@ -151,7 +159,7 @@ GEM
coffee-script-source
execjs
coffee-script-source (1.12.2)
concurrent-ruby (1.0.5)
concurrent-ruby (1.1.3)
copy_carrierwave_file (1.3.0)
carrierwave (>= 0.9)
crack (0.4.3)
@ -214,161 +222,20 @@ GEM
faraday (0.12.2)
multipart-post (>= 1.2, < 3)
ffi (1.9.25)
fission (0.5.0)
CFPropertyList (~> 2.2)
flipflop (2.4.0)
activesupport (>= 4.0)
fog (1.42.0)
fog-aliyun (>= 0.1.0)
fog-atmos
fog-aws (>= 0.6.0)
fog-brightbox (~> 0.4)
fog-cloudatcost (~> 0.1.0)
fog-core (~> 1.45)
fog-digitalocean (>= 0.3.0)
fog-dnsimple (~> 1.0)
fog-dynect (~> 0.0.2)
fog-ecloud (~> 0.1)
fog-google (<= 0.1.0)
fog-internet-archive
fog-joyent
fog-json
fog-local
fog-openstack
fog-ovirt
fog-powerdns (>= 0.1.1)
fog-profitbricks
fog-rackspace
fog-radosgw (>= 0.0.2)
fog-riakcs
fog-sakuracloud (>= 0.0.4)
fog-serverlove
fog-softlayer
fog-storm_on_demand
fog-terremark
fog-vmfusion
fog-voxel
fog-vsphere (>= 0.4.0)
fog-xenserver
fog-xml (~> 0.1.1)
ipaddress (~> 0.5)
json (~> 2.0)
fog-aliyun (0.2.0)
fog-core (~> 1.27)
fog-json (~> 1.0)
ipaddress (~> 0.8)
xml-simple (~> 1.1)
fog-atmos (0.1.0)
fog-core
fog-xml
fog-aws (2.0.0)
fog-core (~> 1.38)
fog-json (~> 1.0)
fog-xml (~> 0.1)
ipaddress (~> 0.8)
fog-brightbox (0.14.0)
fog-core (~> 1.22)
fog-json
inflecto (~> 0.0.2)
fog-cloudatcost (0.1.2)
fog-core (~> 1.36)
fog-json (~> 1.0)
fog-xml (~> 0.1)
ipaddress (~> 0.8)
fog-core (1.45.0)
fog-core (2.1.2)
builder
excon (~> 0.58)
formatador (~> 0.2)
fog-digitalocean (0.3.0)
fog-core (~> 1.42)
fog-json (>= 1.0)
fog-xml (>= 0.1)
ipaddress (>= 0.5)
fog-dnsimple (1.0.0)
fog-core (~> 1.38)
fog-json (~> 1.0)
fog-dynect (0.0.3)
fog-core
fog-json
fog-xml
fog-ecloud (0.3.0)
fog-core
fog-xml
fog-google (0.1.0)
fog-core
fog-json
fog-xml
fog-internet-archive (0.0.1)
fog-core
fog-json
fog-xml
fog-joyent (0.0.1)
fog-core (~> 1.42)
fog-json (>= 1.0)
mime-types
fog-json (1.2.0)
fog-core
multi_json (~> 1.10)
fog-local (0.4.0)
fog-core (~> 1.27)
fog-openstack (0.1.27)
fog-core (~> 1.45.0)
fog-openstack (1.0.6)
fog-core (~> 2.1)
fog-json (>= 1.0)
ipaddress (>= 0.8)
fog-ovirt (0.1.3)
fog-core (~> 1.45)
fog-json
fog-xml (~> 0.1.1)
rbovirt (~> 0.1.5)
fog-powerdns (0.1.1)
fog-core (~> 1.27)
fog-json (~> 1.0)
fog-xml (~> 0.1)
fog-profitbricks (4.1.1)
fog-core (~> 1.42)
fog-json (~> 1.0)
fog-rackspace (0.1.5)
fog-core (>= 1.35)
fog-json (>= 1.0)
fog-xml (>= 0.1)
ipaddress (>= 0.8)
fog-radosgw (0.0.5)
fog-core (>= 1.21.0)
fog-json
fog-xml (>= 0.0.1)
fog-riakcs (0.1.0)
fog-core
fog-json
fog-xml
fog-sakuracloud (1.7.5)
fog-core
fog-json
fog-serverlove (0.1.2)
fog-core
fog-json
fog-softlayer (1.1.4)
fog-core
fog-json
fog-storm_on_demand (0.1.1)
fog-core
fog-json
fog-terremark (0.1.0)
fog-core
fog-xml
fog-vmfusion (0.1.0)
fission
fog-core
fog-voxel (0.1.0)
fog-core
fog-xml
fog-vsphere (1.13.1)
fog-core
rbvmomi (~> 1.9)
fog-xenserver (0.3.0)
fog-core
fog-xml
fog-xml (0.1.3)
fog-core
nokogiri (>= 1.5.11, < 2.0.0)
font-awesome-rails (4.7.0.4)
railties (>= 3.2, < 6.0)
formatador (0.2.5)
@ -426,7 +293,6 @@ GEM
httpclient (2.8.3)
i18n (1.1.1)
concurrent-ruby (~> 1.0)
inflecto (0.0.2)
ipaddress (0.8.3)
jaro_winkler (1.5.1)
jquery-rails (4.3.3)
@ -483,9 +349,9 @@ GEM
marcel (0.3.2)
mimemagic (~> 0.3.2)
method_source (0.9.0)
mime-types (3.1)
mime-types (3.2.2)
mime-types-data (~> 3.2015)
mime-types-data (3.2016.0521)
mime-types-data (3.2018.0812)
mimemagic (0.3.2)
mini_mime (1.0.1)
mini_portile2 (2.3.0)
@ -617,14 +483,6 @@ GEM
ffi
rbnacl-libsodium (1.0.16)
rbnacl (>= 3.0.1)
rbovirt (0.1.5)
nokogiri
rest-client (> 1.7.0)
rbvmomi (1.11.6)
builder (~> 3.0)
json (>= 1.8)
nokogiri (~> 1.5)
trollop (~> 2.1)
request_store (1.4.1)
rack (>= 1.4)
responders (2.4.0)
@ -752,7 +610,6 @@ GEM
thread_safe (0.3.6)
tilt (2.0.8)
timecop (0.9.1)
trollop (2.1.2)
ttfunk (1.5.1)
turbolinks (5.2.0)
turbolinks-source (~> 5.2)
@ -791,7 +648,6 @@ GEM
websocket-driver (0.7.0)
websocket-extensions (>= 0.1.0)
websocket-extensions (0.1.3)
xml-simple (1.1.5)
xpath (3.0.0)
nokogiri (~> 1.8)
xray-rails (0.3.1)
@ -805,6 +661,7 @@ DEPENDENCIES
aasm
active_link_to
active_model_serializers
activestorage-openstack!
administrate
after_party
axlsx (~> 3.0.0.pre)
@ -836,7 +693,6 @@ DEPENDENCIES
draper
factory_bot
flipflop
fog
fog-openstack
font-awesome-rails
groupdate
@ -900,4 +756,4 @@ DEPENDENCIES
zxcvbn-ruby
BUNDLED WITH
1.16.6
1.17.1

View file

@ -33,10 +33,6 @@ class PieceJustificativeUploader < BaseUploader
filename
end
def original_filename
model.original_filename
end
private
def secure_token

View file

@ -18,7 +18,8 @@ BASIC_AUTH_PASSWORD=""
FOG_OPENSTACK_TENANT=""
FOG_OPENSTACK_API_KEY=""
FOG_OPENSTACK_USERNAME=""
FOG_OPENSTACK_AUTH_URL=""
FOG_OPENSTACK_URL=""
FOG_OPENSTACK_IDENTITY_API_VERSION=""
FOG_OPENSTACK_REGION=""
FOG_DIRECTORY=""
FOG_ENABLED=""

View file

@ -1,9 +1,28 @@
module Fog
module ServicesMixin
private
def require_service_provider_library(service, provider)
# Monkey patch to fix https://github.com/fog/fog/issues/4014
# This method exists in fog to load legacy providers that have not yet been extracted to
# their own gem.
# fog-openstack has been extracted to its own gem and does not need this method.
# Furthermore, fog-openstack has recently been refactored in a way that breaks this method.
#
# Therefore, until either fog or fog-openstack fixes the problem, we have to neuter the method.
end
end
end
CarrierWave.configure do |config|
# These permissions will make dir and files available only to the user running
# the servers
config.permissions = 0664
config.directory_permissions = 0775
config.fog_provider = 'fog/openstack'
if ENV['FOG_ENABLED'] == 'enabled'
config.fog_credentials = {
provider: 'OpenStack',
@ -11,7 +30,8 @@ CarrierWave.configure do |config|
openstack_api_key: Rails.application.secrets.fog[:openstack_api_key],
openstack_username: Rails.application.secrets.fog[:openstack_username],
openstack_auth_url: Rails.application.secrets.fog[:openstack_auth_url],
openstack_region: Rails.application.secrets.fog[:openstack_region]
openstack_region: Rails.application.secrets.fog[:openstack_region],
openstack_identity_api_version: Rails.application.secrets.fog[:oopenstack_identity_api_version]
}
end

View file

@ -37,7 +37,8 @@ defaults: &defaults
openstack_tenant: <%= ENV['FOG_OPENSTACK_TENANT'] %>
openstack_api_key: <%= ENV['FOG_OPENSTACK_API_KEY'] %>
openstack_username: <%= ENV['FOG_OPENSTACK_USERNAME'] %>
openstack_auth_url: <%= ENV['FOG_OPENSTACK_AUTH_URL'] %>
openstack_auth_url: <%= ENV['FOG_OPENSTACK_URL'] %>
openstack_identity_api_version: "<%= ENV['FOG_OPENSTACK_IDENTITY_API_VERSION'] %>"
openstack_region: <%= ENV['FOG_OPENSTACK_REGION'] %>
directory: <%= ENV['FOG_DIRECTORY'] %>
carrierwave:

View file

@ -9,3 +9,14 @@ clever_cloud:
access_key_id: <%= ENV['CLEVER_CLOUD_ACCESS_KEY_ID'] %>
secret_access_key: <%= ENV['CLEVER_CLOUD_SECRET_ACCESS_KEY'] %>
bucket: <%= ENV['CLEVER_CLOUD_BUCKET'] %>
openstack:
service: OpenStack
container: "<%= ENV['FOG_DIRECTORY'] %>"
credentials:
openstack_tenant: "<%= ENV['FOG_OPENSTACK_TENANT'] %>"
openstack_api_key: "<%= ENV['FOG_OPENSTACK_API_KEY'] %>"
openstack_username: "<%= ENV['FOG_OPENSTACK_USERNAME'] %>"
openstack_auth_url: "<%= ENV['FOG_OPENSTACK_URL'] %>"
openstack_identity_api_version: "<%= ENV['FOG_OPENSTACK_IDENTITY_API_VERSION'] %>"
openstack_region: "<%= ENV['FOG_OPENSTACK_REGION'] %>"
openstack_temp_url_key: "<%= ENV['FOG_OPENSTACK_TEMP_URL_KEY'] %>"