class Fission::Action::VM::Cloner
def files_to_rename(from, to)
The paths which match the from name will preceed any other files
Returns an Array containing the paths (String) to the files to rename.
# => ['/vms/vm1/foo.vmdk', '/vms/vm1/foo.vmx', 'vms/vm1/blah.other']
@cloner.files_to_rename 'foo', 'bar'
Examples
to - The name of the newly cloned VM.
from - The VM name that was used as the source of the clone.
newly cloned VM directory.
Internal: Provides the list of files which need to be renamed in a
def files_to_rename(from, to) files_which_match_source_vm = [] other_files = [] Dir.entries(@target_vm.path).each do |f| unless f == '.' || f == '..' f.include?(from) ? files_which_match_source_vm << f : other_files << f end end files_which_match_source_vm + other_files end