2019-12-23 06:32:34 +03:00
|
|
|
# Mounts mount point
|
|
|
|
class Tasks::Mount < Task
|
2019-12-23 22:04:43 +03:00
|
|
|
attr_reader :source
|
|
|
|
attr_reader :mount_point
|
|
|
|
|
|
|
|
def initialize(source, mount_point=nil, **named)
|
|
|
|
@named = named
|
|
|
|
if mount_point
|
|
|
|
@source = source
|
|
|
|
@mount_point = mount_point
|
|
|
|
add_dependency(:Files, source)
|
|
|
|
else
|
|
|
|
@source = named[:type]
|
|
|
|
@mount_point = source
|
|
|
|
end
|
2019-12-23 06:32:34 +03:00
|
|
|
add_dependency(:SingletonTask, :Environment)
|
|
|
|
end
|
|
|
|
|
|
|
|
def run()
|
2019-12-23 22:04:43 +03:00
|
|
|
FileUtils.mkdir_p(mount_point)
|
|
|
|
System.mount(source, mount_point, **@named)
|
|
|
|
end
|
|
|
|
|
|
|
|
def type
|
|
|
|
@named[:type]
|
2019-12-23 06:32:34 +03:00
|
|
|
end
|
|
|
|
|
|
|
|
def name()
|
2019-12-23 22:04:43 +03:00
|
|
|
"#{super}(#{source}, #{mount_point}, #{@named.inspect})"
|
2019-12-23 06:32:34 +03:00
|
|
|
end
|
|
|
|
end
|