Class: Bosh::Agent::Infrastructure::Aws::Settings
- Defined in:
- lib/bosh_agent/infrastructure/aws/settings.rb
Constant Summary collapse
- VIP_NETWORK_TYPE =
"vip"
- DHCP_NETWORK_TYPE =
"dynamic"
- MANUAL_NETWORK_TYPE =
"manual"
- SUPPORTED_NETWORK_TYPES =
[ VIP_NETWORK_TYPE, DHCP_NETWORK_TYPE, MANUAL_NETWORK_TYPE ]
- AUTHORIZED_KEYS =
File.join("/home/", BOSH_APP_USER, ".ssh/authorized_keys")
Instance Method Summary collapse
- #authorized_keys ⇒ Object
- #get_network_settings(network_name, properties) ⇒ Object
- #load_settings ⇒ Object
- #logger ⇒ Object
- #setup_openssh_key ⇒ Object
Instance Method Details
#authorized_keys ⇒ Object
20 21 22 |
# File 'lib/bosh_agent/infrastructure/aws/settings.rb', line 20 def AUTHORIZED_KEYS end |
#get_network_settings(network_name, properties) ⇒ Object
44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/bosh_agent/infrastructure/aws/settings.rb', line 44 def get_network_settings(network_name, properties) type = properties["type"] || "manual" unless type && SUPPORTED_NETWORK_TYPES.include?(type) raise Bosh::Agent::StateError, "Unsupported network type '%s', valid types are: %s" % [type, SUPPORTED_NETWORK_TYPES.join(', ')] end # Nothing to do for "vip" and "manual" networks return nil if [VIP_NETWORK_TYPE, MANUAL_NETWORK_TYPE].include? type Bosh::Agent::Util.get_network_info end |
#load_settings ⇒ Object
39 40 41 42 |
# File 'lib/bosh_agent/infrastructure/aws/settings.rb', line 39 def load_settings setup_openssh_key Infrastructure::Aws::Registry.get_settings end |
#logger ⇒ Object
16 17 18 |
# File 'lib/bosh_agent/infrastructure/aws/settings.rb', line 16 def logger Bosh::Agent::Config.logger end |
#setup_openssh_key ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/bosh_agent/infrastructure/aws/settings.rb', line 24 def setup_openssh_key public_key = Infrastructure::Aws::Registry.get_openssh_key if public_key.nil? || public_key.empty? return end FileUtils.mkdir_p(File.dirname()) FileUtils.chmod(0700, File.dirname()) FileUtils.chown(Bosh::Agent::BOSH_APP_USER, Bosh::Agent::BOSH_APP_GROUP, File.dirname()) File.open(, "w") { |f| f.write(public_key) } FileUtils.chown(Bosh::Agent::BOSH_APP_USER, Bosh::Agent::BOSH_APP_GROUP, ) FileUtils.chmod(0644, ) end |