aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNathan Lasseter <nathan@4574.co.uk>2013-06-17 19:25:21 +0100
committerNathan Lasseter <nathan@4574.co.uk>2013-06-17 19:25:21 +0100
commit996814c2a35b6dfd50fac3c808ce4203734915d7 (patch)
treec580f1fb393f5916d36e6721ce7bbcc740f802c6
parent64da0a3c03cec708a88591d218194d64538dfccb (diff)
Changed uselibrary and added backupHEADmaster
-rw-r--r--tapelibrary.rb22
-rw-r--r--ystv.rb13
2 files changed, 30 insertions, 5 deletions
diff --git a/tapelibrary.rb b/tapelibrary.rb
index daf0e2e..ee57dbc 100644
--- a/tapelibrary.rb
+++ b/tapelibrary.rb
@@ -35,8 +35,8 @@ class RobotBuilder
@name = name
@libraries = Hash.new
end
- def uselibrary name, library
- @libraries[name] = library
+ def uselibrary library
+ @libraries[library.name] = library
end
def build
Robot.new @name, @libraries
@@ -46,3 +46,21 @@ end
def robot name, &block
Docile.dsl_eval(RobotBuilder.new(name), &block).build
end
+
+Backup = Struct.new(:name, :robot, :backups)
+
+class BackupBuilder
+ def initialize name, robot
+ @name = name
+ @robot = robot
+ end
+ def backup bkp = {}
+ bkp.each do |dir, lib|
+ puts "Backup #{@name}: Backing up #{dir} to library #{lib} on robot #{@robot.name}"
+ end
+ end
+end
+
+def backups name, robot, &block
+ Docile.dsl_eval(BackupBuilder.new(name, robot), &block)
+end
diff --git a/ystv.rb b/ystv.rb
index 2d90802..ae94acb 100644
--- a/ystv.rb
+++ b/ystv.rb
@@ -24,7 +24,14 @@ urylib = library "ury" do
tape "ury010", :slot => 20
end
-tapebackup = robot "tapebackup" do
- uselibrary "ystv", ystvlib
- uselibrary "ury", urylib
+wallyrobot = robot "wally" do
+ uselibrary ystvlib
+ uselibrary urylib
+end
+
+backups "backuptotape", wallyrobot do
+ backup(
+ "/data/backups/" => "ystv",
+ "/mnt/urybackup/" => "ury"
+ )
end