module Kontena::Plugin::Upcloud::Prompts::Create
Public Class Methods
included(base)
click to toggle source
# File lib/kontena/plugin/upcloud/prompts.rb, line 59 def self.included(base) base.include Common base.prepend Defaults base.option "--ssh-key", "SSH_KEY", "Path to ssh public key", attribute_name: :ssh_key_path base.option "--version", "VERSION", "Define installed Kontena version", default: 'latest' base.option "--zone", "ZONE", "Zone", required: true base.option "--plan", "PLAN", "Server size", required: true end
Public Instance Methods
ssh_key()
click to toggle source
# File lib/kontena/plugin/upcloud/prompts.rb, line 68 def ssh_key return File.read(ssh_key_path).strip unless ssh_key_path.nil? default = File.read(Defaults::DEFAULT_SSH_KEY_PATH).strip rescue nil prompt.ask('SSH public key: (enter an ssh key in OpenSSH format "ssh-xxx xxxxx key_name")', default: default) do |q| q.validate /^ssh-rsa \S+ \S+$/ end end