Class: AmoebaDeployTools::Key
- Defined in:
- lib/amoeba_deploy_tools/commands/key.rb
Instance Method Summary collapse
Methods inherited from Command
Methods included from Concerns::Hooks
Constructor Details
This class inherits a constructor from AmoebaDeployTools::Command
Instance Method Details
#create(name = nil) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/amoeba_deploy_tools/commands/key.rb', line 5 def create(name=nil) validate_chef_id!(name) key = Cocaine::CommandLine.new('openssl', "rand -base64 512 | tr -d '\\r\\n'", runner: Cocaine::CommandLine::BackticksRunner.new).run config.private_keys![name] = key logger.debug "Saving key to `.amoeba.yml` config" if config.new_file? say_fatal "Cannot create new key, no .amoeba.yml file found! Please run `amoeba init`" end config.save end |