File tree Expand file tree Collapse file tree 2 files changed +4
-2
lines changed Expand file tree Collapse file tree 2 files changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -25,9 +25,10 @@ class Directory
25
25
@@PRIORITY = 0
26
26
attr_reader :PRIORITY
27
27
28
- def initialize ( url )
28
+ def initialize ( url , readonly = false )
29
29
@module_dir = url
30
30
@log = PuppetForgeServer ::Logger . get
31
+ @readonly = readonly
31
32
end
32
33
33
34
def query_metadata ( query , options = { } )
@@ -45,6 +46,7 @@ def get_file_buffer(relative_path)
45
46
end
46
47
47
48
def upload ( file_data )
49
+ return false if @readonly
48
50
filename = File . join ( @module_dir , file_data [ :filename ] )
49
51
return false if File . exist? ( filename )
50
52
File . open ( filename , 'w' ) do |f |
Original file line number Diff line number Diff line change @@ -93,7 +93,7 @@ def start(server, options)
93
93
private
94
94
def backends ( options )
95
95
# Add directory backend for serving cached modules in case proxy flips over
96
- backends = options [ :backend ] [ 'Proxy' ] && ! options [ :backend ] [ 'Proxy' ] . empty? ? [ PuppetForgeServer ::Backends . const_get ( 'Directory' ) . new ( options [ :cache_basedir ] ) ] : [ ]
96
+ backends = options [ :backend ] [ 'Proxy' ] && ! options [ :backend ] [ 'Proxy' ] . empty? ? [ PuppetForgeServer ::Backends . const_get ( 'Directory' ) . new ( options [ :cache_basedir ] , true ) ] : [ ]
97
97
backends << options [ :backend ] . map do |type , typed_backends |
98
98
typed_backends . map do |url |
99
99
case type
You can’t perform that action at this time.
0 commit comments