mirror of
https://github.com/balena-io/balena-cli.git
synced 2024-12-21 06:33:28 +00:00
Auto-merge for PR #737 via VersionBot
Add ssh option for direct host OS access
This commit is contained in:
commit
743392017d
@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file
|
||||
automatically by Versionist. DO NOT EDIT THIS FILE MANUALLY!
|
||||
This project adheres to [Semantic Versioning](http://semver.org/).
|
||||
|
||||
## v6.12.0 - 2017-12-19
|
||||
|
||||
* Add ssh option for direct host OS access #737 [Andreas Fitzek]
|
||||
|
||||
## v6.11.0 - 2017-12-18
|
||||
|
||||
* Fix docs generation when building on windows #729 [Tim Perry]
|
||||
|
@ -808,6 +808,7 @@ Examples:
|
||||
$ resin ssh 7cf02a6
|
||||
$ resin ssh 7cf02a6 --port 8080
|
||||
$ resin ssh 7cf02a6 -v
|
||||
$ resin ssh 7cf02a6 -s
|
||||
|
||||
### Options
|
||||
|
||||
@ -819,6 +820,10 @@ ssh gateway port
|
||||
|
||||
increase verbosity
|
||||
|
||||
#### --host, -s
|
||||
|
||||
access host OS (for devices with Resin OS >= 2.7.5)
|
||||
|
||||
#### --noproxy
|
||||
|
||||
don't use the proxy configuration for this connection. Only makes sense if you've configured proxy globally.
|
||||
|
@ -98,3 +98,9 @@ exports.advancedConfig =
|
||||
description: 'show advanced configuration options'
|
||||
boolean: true
|
||||
alias: 'v'
|
||||
|
||||
exports.hostOSAccess =
|
||||
signature: 'host'
|
||||
boolean: true
|
||||
description: 'access host OS (for devices with Resin OS >= 2.7.5)'
|
||||
alias: 's'
|
||||
|
@ -14,6 +14,12 @@ See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
###
|
||||
|
||||
{ hostOSAccess } = require('../command-options')
|
||||
_ = require('lodash')
|
||||
|
||||
localHostOSAccessOption = _.cloneDeep(hostOSAccess)
|
||||
localHostOSAccessOption.description = 'get a shell into the host OS'
|
||||
|
||||
module.exports =
|
||||
signature: 'local ssh [deviceIp]'
|
||||
description: 'Get a shell into a resinOS device'
|
||||
@ -43,11 +49,7 @@ module.exports =
|
||||
description: 'increase verbosity'
|
||||
alias: 'v'
|
||||
,
|
||||
signature: 'host'
|
||||
boolean: true
|
||||
description: 'get a shell into the host OS'
|
||||
alias: 's'
|
||||
,
|
||||
localHostOSAccessOption,
|
||||
signature: 'container'
|
||||
parameter: 'container'
|
||||
default: null
|
||||
|
@ -14,6 +14,8 @@ See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
###
|
||||
|
||||
commandOptions = require('./command-options')
|
||||
|
||||
module.exports =
|
||||
signature: 'ssh [uuid]'
|
||||
description: '(beta) get a shell into the running app container of a device'
|
||||
@ -31,6 +33,7 @@ module.exports =
|
||||
$ resin ssh 7cf02a6
|
||||
$ resin ssh 7cf02a6 --port 8080
|
||||
$ resin ssh 7cf02a6 -v
|
||||
$ resin ssh 7cf02a6 -s
|
||||
'''
|
||||
permission: 'user'
|
||||
primary: true
|
||||
@ -44,7 +47,7 @@ module.exports =
|
||||
boolean: true
|
||||
description: 'increase verbosity'
|
||||
alias: 'v'
|
||||
,
|
||||
commandOptions.hostOSAccess,
|
||||
signature: 'noproxy'
|
||||
boolean: true
|
||||
description: "don't use the proxy configuration for this connection.
|
||||
@ -109,7 +112,7 @@ module.exports =
|
||||
username: resin.auth.whoami()
|
||||
uuid: device.uuid
|
||||
# get full uuid
|
||||
containerId: resin.models.device.getApplicationInfo(device.uuid).get('containerId')
|
||||
containerId: if options.host then '' else resin.models.device.getApplicationInfo(device.uuid).get('containerId')
|
||||
proxyUrl: resin.settings.get('proxyUrl')
|
||||
|
||||
hasTunnelBin: if useProxy then hasbin('proxytunnel') else null
|
||||
@ -117,12 +120,18 @@ module.exports =
|
||||
throw new Error('Did not find running application container') if not containerId?
|
||||
Promise.try ->
|
||||
sshProxyCommand = getSshProxyCommand(hasTunnelBin)
|
||||
|
||||
if options.host
|
||||
accessCommand = "host #{uuid}"
|
||||
else
|
||||
accessCommand = "enter #{uuid} #{containerId}"
|
||||
|
||||
command = "ssh #{verbose} -t \
|
||||
-o LogLevel=ERROR \
|
||||
-o StrictHostKeyChecking=no \
|
||||
-o UserKnownHostsFile=/dev/null \
|
||||
#{sshProxyCommand} \
|
||||
-p #{options.port} #{username}@ssh.#{proxyUrl} enter #{uuid} #{containerId}"
|
||||
-p #{options.port} #{username}@ssh.#{proxyUrl} #{accessCommand}"
|
||||
|
||||
subShellCommand = getSubShellCommand(command)
|
||||
child_process.spawn subShellCommand.program, subShellCommand.args,
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "resin-cli",
|
||||
"version": "6.11.0",
|
||||
"version": "6.12.0",
|
||||
"description": "The official resin.io CLI tool",
|
||||
"main": "./build/actions/index.js",
|
||||
"homepage": "https://github.com/resin-io/resin-cli",
|
||||
|
Loading…
Reference in New Issue
Block a user