Skip to content
This repository has been archived by the owner on Nov 9, 2020. It is now read-only.

Better mark loading from file. Now using YAML so works with multiple hosts. #22

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions README.rdoc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 12 additions & 0 deletions bin/rvc
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down