From 749d85a88bb02a19ac412f5e22f13647c25bb6a0 Mon Sep 17 00:00:00 2001 From: Marcus Stong Date: Tue, 18 Aug 2015 12:45:23 -0400 Subject: [PATCH 1/2] do not force unitfile presence in start method. minor README tweaks --- README.md | 38 +++++++++++++++++++------------------- index.js | 4 ++-- package.json | 2 +- 3 files changed, 22 insertions(+), 22 deletions(-) diff --git a/README.md b/README.md index 3aa4961..3a8c2b0 100644 --- a/README.md +++ b/README.md @@ -28,29 +28,29 @@ the envvar `DEBUG` to `fleetctl` when you run your program that uses this module ## API -**.cat(unitName)** +**.cat(unitName)** Output the contents of a submitted unit. -**.debugInfo()** +**.debugInfo()** Print out debug information. -**.destroy(unitName)** +**.destroy(unitName)** Destroy one or more units in the cluster. -**.journal(unitName, options)** -Print the journal of a unit in the cluster to stdout. +**.journal(unitName, options)** +Print the journal of a unit in the cluster to stdout. Options: * `follow` Continuously print new entries as they are appended to the journal. * `lines` Number of recent log lines to return -**.listMachines()** +**.listMachines()** Enumerate the current hosts in the cluster. -**.listUnits()** +**.listUnits()** Enumerate units loaded in the cluster. -**.load(unitName, options)** -Schedule one or more units in the cluster, first submitting them if necessary. You must supply either one of the `unitFile` or `unitFileData` options, below. +**.load(unitName, options)** +Schedule one or more units in the cluster, first submitting them if necessary. You must supply either one of the `unitFile` or `unitFileData` options, below. Options: * `unitFile` The path to the unit file to load. * `unitFileData` The contents of the unit file itself, base64-encoded. @@ -58,8 +58,8 @@ Options: * `noBlock` Do not wait until the jobs have been loaded before exiting. * `sign` Sign unit file signatures and verify submitted units using local SSH identities. -**.start(unitName, options)** -Instruct systemd to start one or more units in the cluster, first submitting and loading if necessary. You must supply either one of the `unitFile` or `unitFileData` options, below. +**.start(unitName, options)** +Instruct systemd to start one or more units in the cluster, first submitting and loading if necessary. Options: * `unitFile` The path to the unit file to start. * `unitFileData` The contents of the unit file itself, base64-encoded. @@ -67,29 +67,29 @@ Options: * `noBlock` Do not wait until the jobs have been launched before exiting. * `sign` Sign unit file signatures using local SSH identities. -**.status(unitFile)** +**.status(unitName)** Output the status of one or more units in the cluster -**.stop(unitFile)** -Instruct systemd to stop one or more units in the cluster. +**.stop(unitName)** +Instruct systemd to stop one or more units in the cluster. Options: * `blockAttempts` Wait until the jobs are stopped, performing up to N attempts before giving up. A value of 0 indicates no limit. * `noBlock` Do not wait until the jobs have stopped before exiting. -**.submit(unitFile, options)** -Upload one or more units to the cluster without starting them. You must supply either one of the `unitFile` or `unitFileData` options, below. +**.submit(unitFile, options)** +Upload one or more units to the cluster without starting them. You must supply either one of the `unitFile` or `unitFileData` options, below. Options: * `unitFile` The path to the unit file to submit. * `unitFileData` The contents of the unit file itself, base64-encoded. * `sign` Sign unit files units using local SSH identities -**.unload(unitFile, options)** -Unschedule one or more units in the cluster. +**.unload(unitName, options)** +Unschedule one or more units in the cluster. Options: * `blockAttempts` Wait until the jobs are inactive, performing up to N attempts before giving up. A value of 0 indicates no limit. * `noBlock` Do not wait until the jobs have become inactive before exiting. -**.verify(unitFile)** +**.verify(unitFile)** Verify unit file signatures using local SSH identities. ## Licence diff --git a/index.js b/index.js index 135e988..93878f8 100644 --- a/index.js +++ b/index.js @@ -50,8 +50,8 @@ FleetAPI.prototype._ssh_fleetctl = function (command, args, options, cb) { if (options.unitFileData) { env.FLEETW_UNIT_DATA = options.unitFileData; } - else { - env.FLEETW_UNIT_FILE = options.unitFile || getUnitFilename(options.unit); + else if (options.unitFile) { + env.FLEETW_UNIT_FILE = options.unitFile; } } } diff --git a/package.json b/package.json index ecb95c9..56e282a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "fleetctl-ssh", - "version": "0.2.1", + "version": "0.3.0", "description": "A Node.js workalike module for CoreOS' fleetctl that that runs remotely over SSH, allowing you to use it from inside a Docker container. Inspired by @opendeis' scheduler.", "repository": { "type": "git", From 853d74b5080aa24dbaf6fd57341b90a37391dc07 Mon Sep 17 00:00:00 2001 From: Marcus Stong Date: Wed, 2 Sep 2015 22:15:50 -0400 Subject: [PATCH 2/2] pipe stderr to stdout in bash --- bin/fleetctl.sh | 4 ++-- package.json | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/bin/fleetctl.sh b/bin/fleetctl.sh index c51bbbe..a0521e7 100755 --- a/bin/fleetctl.sh +++ b/bin/fleetctl.sh @@ -24,7 +24,7 @@ if [[ $FLEETW_UNIT && ($FLEETW_UNIT_DATA || $FLEETW_UNIT_FILE) ]]; then SCP_OPTIONS=$OPTIONS [[ $FLEETW_PORT ]] && SCP_OPTIONS="-P $FLEETW_PORT $SCP_OPTIONS" - ssh $SSH_OPTIONS core@$FLEETW_HOST "cat - > $FLEETW_UNIT ; fleetctl $@ $FLEETW_UNIT" < $unitfile + 2>&1 ssh $SSH_OPTIONS core@$FLEETW_HOST "2>&1 cat - > $FLEETW_UNIT ; fleetctl $@ $FLEETW_UNIT" < $unitfile else - ssh $SSH_OPTIONS core@$FLEETW_HOST fleetctl $@ + 2>&1 ssh $SSH_OPTIONS core@$FLEETW_HOST fleetctl $@ fi diff --git a/package.json b/package.json index 56e282a..77c51b2 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { - "name": "fleetctl-ssh", - "version": "0.3.0", + "name": "fleetctl-ssh-fork", + "version": "0.4.0", "description": "A Node.js workalike module for CoreOS' fleetctl that that runs remotely over SSH, allowing you to use it from inside a Docker container. Inspired by @opendeis' scheduler.", "repository": { "type": "git",