From fa37755e1cb41e2863773772949740f8041a7f0c Mon Sep 17 00:00:00 2001 From: Ben Hughes Date: Wed, 31 Aug 2011 16:04:26 -0700 Subject: [PATCH 1/2] Load "saved" marks from YAML, so we can have per host marks, rather than just one giant apply to all list. [ben@laptop:~]% cat .rvc-marks.yaml vc01.example.org: { alice: /vc01.example.org/dc01/host/alice.puppetlabs.lan/, bob: /vc01.example.org/dc01/host/bob.puppetlabs.lan/ } test.example.org: { data: /vc02/dc02/datastore } Then on vc01.example.org it will load in those two marks as CLI inception. --- bin/rvc | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/bin/rvc b/bin/rvc index 2ccfeb9..65fcef1 100644 --- a/bin/rvc +++ b/bin/rvc @@ -130,6 +130,18 @@ if $interactive $stderr.puts "VMRC is not installed. You will be unable to view virtual machine consoles. Use the vmrc.install command to install it." unless CMD.vmrc.find_vmrc $stderr.puts "Use the 'connect' command to connect to an ESX or VC server." if $shell.connections.empty? CMD.basic.ls RVC::Util.lookup_single('.') + + # Load the marks YAML file, and see if we have one defined for this host. Apply those marks if we do. + marks_fn = "#{ENV['HOME']}/.rvc-marks.yaml" + if File.exists? marks_fn + marks = YAML.load_file marks_fn + connected_hostname = $shell.connections.first.first + if marks[connected_hostname] + marks[connected_hostname].each do |mark,path| + $shell.session.set_mark mark, [ RVC::Util.lookup_single( path ) ] + end + end + end end if $opts[:script] From fc3a957b8b143065e60ca9d73fe461884582705b Mon Sep 17 00:00:00 2001 From: Ben Hughes Date: Wed, 31 Aug 2011 16:12:46 -0700 Subject: [PATCH 2/2] Updated the documentation on loading marks with the YAML file addition. --- README.rdoc | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/README.rdoc b/README.rdoc index 884b9c5..f59fa94 100644 --- a/README.rdoc +++ b/README.rdoc @@ -91,6 +91,13 @@ When the working directory is a descendant of a Datacenter object, the mark "~" refers to the Datacenter. For example "~/datastore" is a convenient way to get the datastore folder of the current datacenter. +Loading marks is possible too. A file named ~/.rvc-marks.yaml in the +simple format of: + +vcenter.hostname: { markname: /path/name/, + anothermarkname: /a/longer/path/name } +another.vcenter.host: { ... } + === Aggregate marks More than one object can be given to the "mark" command. The resulting mark can