Skip to content
This repository was archived by the owner on Jan 30, 2020. It is now read-only.

fleetctl: properly run local and remote commands#1253

Merged
crawford merged 1 commit into
coreos:masterfrom
crawford:run
Jun 17, 2015
Merged

fleetctl: properly run local and remote commands#1253
crawford merged 1 commit into
coreos:masterfrom
crawford:run

Conversation

@crawford
Copy link
Copy Markdown
Contributor

Remote commands need to be escaped because they are being interpretted
by a shell. Local commands, however, cannot be because they are being
exec'd. Additionally, splitting an opaque command by space is very error
prone (e.g. ls "dumb filename").

Remote commands need to be escaped because they are being interpretted
by a shell. Local commands, however, cannot be because they are being
exec'd. Additionally, splitting an opaque command by space is very error
prone (e.g. `ls "dumb filename"`).
@crawford
Copy link
Copy Markdown
Contributor Author

Still testing...

@crawford
Copy link
Copy Markdown
Contributor Author

Locally running service:

$ ./fleetctl status redis.service
● redis.service
   Loaded: loaded (/run/fleet/units/redis.service; linked-runtime; vendor preset: disabled)
   Active: active (running) since Wed 2015-06-17 20:59:18 ; 2h 13min ago
 Main PID: 651 (sleep)
   Memory: 120.0K
   CGroup: /system.slice/redis.service
           └─651 /usr/bin/sleep 1000000

Jun 17 20:59:18 crawford-test-2 systemd[1]: Started redis.service.
Jun 17 20:59:18 crawford-test-2 systemd[1]: Starting redis.service...

Remotely running service:

$ ./fleetctl status redis.service
● redis.service
   Loaded: loaded (/run/fleet/units/redis.service; linked-runtime; vendor preset: disabled)
   Active: active (running) since Wed 2015-06-17 20:59:18 ; 2h 14min ago
 Main PID: 651 (sleep)
   Memory: 120.0K
   CGroup: /system.slice/redis.service
           └─651 /usr/bin/sleep 1000000

Jun 17 20:59:18 crawford-test-2 systemd[1]: Started redis.service.
Jun 17 20:59:18 crawford-test-2 systemd[1]: Starting redis.service...
$ ./fleetctl journal redis.service
-- Logs begin at Wed 2015-06-17 20:56:43 , end at Wed 2015-06-17 23:16:03 . --
Jun 17 20:59:18 crawford-test-2 systemd[1]: Started redis.service.
Jun 17 20:59:18 crawford-test-2 systemd[1]: Starting redis.service...
$ ./fleetctl journal --sudo redis.service       
-- Logs begin at Wed 2015-06-17 20:56:43 , end at Wed 2015-06-17 23:16:15 . --
Jun 17 20:59:18 crawford-test-2 systemd[1]: Started redis.service.
Jun 17 20:59:18 crawford-test-2 systemd[1]: Starting redis.service...
$ ./fleetctl journal --sudo --follow redis.service
-- Logs begin at Wed 2015-06-17 20:56:43 . --
Jun 17 20:59:18 crawford-test-2 systemd[1]: Started redis.service.
Jun 17 20:59:18 crawford-test-2 systemd[1]: Starting redis.service...^C

@crawford
Copy link
Copy Markdown
Contributor Author

govet is failing to compile. Fantastic.

@jonboulle
Copy link
Copy Markdown
Contributor

The approach lgtm

@crawford
Copy link
Copy Markdown
Contributor Author

$ go version
go version go1.4 linux/amd64
$ ./test                           
Building fleetd...
Building fleetctl...
Running tests...
ok      github.com/coreos/fleet/agent   0.010s  coverage: 70.6% of statements
ok      github.com/coreos/fleet/api 0.008s  coverage: 80.4% of statements
ok      github.com/coreos/fleet/config  0.003s  coverage: 100.0% of statements
ok      github.com/coreos/fleet/engine  0.009s  coverage: 54.5% of statements
ok      github.com/coreos/fleet/fleetctl    0.012s  coverage: 23.2% of statements
ok      github.com/coreos/fleet/job 0.007s  coverage: 89.2% of statements
ok      github.com/coreos/fleet/machine 0.004s  coverage: 35.1% of statements
ok      github.com/coreos/fleet/pkg 0.023s  coverage: 81.9% of statements
ok      github.com/coreos/fleet/pkg/lease   0.004s  coverage: 14.3% of statements
ok      github.com/coreos/fleet/registry    0.004s  coverage: 26.7% of statements
ok      github.com/coreos/fleet/ssh 0.005s  coverage: 42.5% of statements
ok      github.com/coreos/fleet/systemd 0.003s  coverage: 15.5% of statements
ok      github.com/coreos/fleet/unit    0.003s  coverage: 88.4% of statements
Checking gofmt...
Checking govet...
Success

@bcwaldon
Copy link
Copy Markdown
Contributor

@crawford LGTM, stupid travis

crawford added a commit that referenced this pull request Jun 17, 2015
fleetctl: properly run local and remote commands
@crawford crawford merged commit bb2b7af into coreos:master Jun 17, 2015
@crawford crawford deleted the run branch June 17, 2015 23:30
@oxtopus
Copy link
Copy Markdown
Contributor

oxtopus commented Jun 18, 2015

Thanks!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants