Module: ChefWorkstationInitialize::SelfBootstrap::NoChef::SSHHelpers

Includes:
CommandlineHelpers
Included in:
GitHelpers
Defined in:
lib/selfbootstrap/nochef/ssh.rb

Instance Method Summary collapse

Methods included from CommandlineHelpers

#base_command, #get_homedir, #is_mixlib_disabled?, #main_command, #run_options

Methods included from DefaultMethodsHelpers

#analyse_object, #check_install_dir, #debug_worklog, #default_chefzero_portrange, #default_hostname, #default_install_dir, #define_resource_requirements, #error_worklog, #generate_default_install_dir, #generate_directory, #get_out_of_cache_path, #get_out_of_folder, #get_out_of_local_chef_path, #get_path, #is_chef_constant_enabled?, #parent_nil?, #require_implement_method, #search_local_project_folder, #warning_worklog, #worklog, #worklog_counter

Instance Method Details

#delete_hostkeyObject



41
42
43
44
45
46
# File 'lib/selfbootstrap/nochef/ssh.rb', line 41

def delete_hostkey
  worklog('Running method delete_hostkey' + " for class #{self.class} inside file #{__FILE__}")

  delete_hostkey_ip_or_name(node['fqdn'])
  delete_hostkey_ip_or_name(node['ipaddress'])
end

#delete_hostkey_ip_or_name(ip_or_name) ⇒ Object



34
35
36
37
38
39
# File 'lib/selfbootstrap/nochef/ssh.rb', line 34

def delete_hostkey_ip_or_name(ip_or_name)
  worklog('Running method delete_hostkey_ip_or_name(ip_or_name)' + " for class #{self.class} inside file #{__FILE__}")

  debug_worklog 'Delete_ssh_machine_key of ' + ip_or_name.to_s
  ssh_keygen "-R #{ip_or_name}"
end

#generate_private_key(privkey) ⇒ Object



48
49
50
# File 'lib/selfbootstrap/nochef/ssh.rb', line 48

def generate_private_key(privkey)
  ssh_keygen "-m 'RFC4716' -N '' -P '' -f #{privkey}"
end

#ssh(*args, **run_opts) ⇒ Object



20
21
22
# File 'lib/selfbootstrap/nochef/ssh.rb', line 20

def ssh(*args, **run_opts)
  base_command('ssh', args, run_opts)
end

#ssh_command(ip_or_name, user, command) ⇒ Object



28
29
30
31
32
# File 'lib/selfbootstrap/nochef/ssh.rb', line 28

def ssh_command(ip_or_name, user, command)
  worklog('Running method ssh_command(ip_or_name, user, command)' + " for class #{self.class} inside file #{__FILE__}")

  ssh "-o StrictHostKeyChecking=no -l #{user} #{ip_or_name} #{command}"
end

#ssh_keygen(*args, **run_opts) ⇒ Object



24
25
26
# File 'lib/selfbootstrap/nochef/ssh.rb', line 24

def ssh_keygen(*args, **run_opts)
  base_command('ssh-keygen', args, run_opts)
end