Class: Dependencies::Sshkey

Inherits:
Dependency show all
Defined in:
lib/dependencies/sshkey.rb

Constant Summary collapse

DEFAULT_KEY_SIZE =
2048
DEFAULT_KEY_ALGO =
"rsa"
DEFAULT_KEY_LIFETIME_S =
3600
DEFAULT_KEY_FILE_COMMENT_COMMAND =
"[email protected]`hostname -s`"

Constants inherited from Dependency

Dependency::DESCRIPTION_TYPE_WIDTH

Instance Attribute Summary

Attributes inherited from Dependency

#name

Instance Method Summary collapse

Methods inherited from Dependency

#always_act?, #exit_code, #initialize, #output, #success?, #type

Constructor Details

This class inherits a constructor from Dependency

Instance Method Details

#meetObject


19
20
21
22
23
24
25
26
27
# File 'lib/dependencies/sshkey.rb', line 19

def meet
	Secrets.load

	Output.warn("\nNo passphrase set for SSH key '#{priv_key_name}'") if passphrase.nil? || passphrase.empty?

	FileUtils.mkdir_p(dir_name) unless File.directory?(dir_name)
	generate_key unless File.exist?(priv_key_name) && File.exist?(pub_key_name)
	add_key if success? && should_add_key?
end

#met?Boolean

Returns:

  • (Boolean)

14
15
16
17
# File 'lib/dependencies/sshkey.rb', line 14

def met?
	# we always need to at least update the key lifetime in the agent
	false
end

#should_meet?Boolean

Returns:

  • (Boolean)

33
34
35
# File 'lib/dependencies/sshkey.rb', line 33

def should_meet?
	true
end

#unmeetObject


29
30
31
# File 'lib/dependencies/sshkey.rb', line 29

def unmeet
	true
end