Class: Bosh::Cli::Command::Ssh
Constant Summary collapse
- SSH_USER_PREFIX =
'bosh_'
- SSH_DSA_PUB =
File.('~/.ssh/id_dsa.pub')
- SSH_RSA_PUB =
File.('~/.ssh/id_rsa.pub')
Constants inherited from Base
Instance Attribute Summary
Attributes inherited from Base
#args, #exit_code, #options, #out, #runner, #work_dir
Instance Method Summary collapse
Methods inherited from Base
#add_option, #blob_manager, #blobstore, #config, #confirmed?, #deployment, #director, #initialize, #interactive?, #logged_in?, #non_interactive?, #password, #redirect, #release, #remove_option, #target, #target_name, #username, #verbose?
Methods included from Bosh::Cli::CommandDiscovery
#desc, #method_added, #option, #register_command, #usage
Methods included from DeploymentHelper
#cancel_deployment, #deployment_changed?, #inspect_deployment_changes, #job_exists_in_deployment?, #job_must_exist_in_deployment, #job_unique_in_deployment?, #jobs_and_indexes, #latest_release_versions, #prepare_deployment_manifest, #prompt_for_job_and_index, #resolve_release_aliases
Methods included from VersionCalc
#major_version, #minor_version, #version_cmp, #version_greater, #version_less, #version_same
Constructor Details
This class inherits a constructor from Bosh::Cli::Command::Base
Instance Method Details
#cleanup(*args) ⇒ Object
70 71 72 73 74 75 76 77 78 79 80 81 82 |
# File 'lib/cli/commands/ssh.rb', line 70 def cleanup(*args) job, index, args = JobCommandArgs.new(args).to_a if args.size > 0 err("SSH cleanup doesn't accept any extra args") end job_must_exist_in_deployment(job) manifest_name = prepare_deployment_manifest['name'] say("Cleaning up ssh artifacts from #{job}/#{index}") director.cleanup_ssh(manifest_name, job, "^#{SSH_USER_PREFIX}", [index]) end |
#scp(*args) ⇒ Object
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/cli/commands/ssh.rb', line 50 def scp(*args) job, index, args = JobCommandArgs.new(args).to_a upload = [:upload] download = [:download] if (upload && download) || (upload.nil? && download.nil?) err('Please specify either --upload or --download') end job_must_exist_in_deployment(job) if args.size != 2 err('Please enter valid source and destination paths') end say("Executing file operations on job #{job}") perform_operation(upload ? :upload : :download, job, index, args) end |
#shell(*args) ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/cli/commands/ssh.rb', line 20 def shell(*args) if args.size > 0 job, index, command = JobCommandArgs.new(args).to_a else command = '' job, index = prompt_for_job_and_index end job_must_exist_in_deployment(job) index = valid_index_for(job, index, integer_index: true) if command.empty? setup_interactive_shell(job, index) else say("Executing `#{command.join(' ')}' on #{job}/#{index}") perform_operation(:exec, job, index, command) end end |