Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initial implementation of step-wise execution for #5 #6

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

tbatchelli
Copy link
Member

(use 'pallet.repl)
(use 'pallet.api)
(use 'pallet.actions)
(require '[pallet.crate :as crate])

(def c (compute-service :aws))

;; initiate session
(start-repl-session c {:image {:image-id "us-east-1/ami-89181be0"}})

;; do a mock run of a plan function
(explain-step (plan-fn (exec-script "ls -la /")(crate/assoc-settings :mongodb [:cluster false])))

NODE: [repl-session-36fc6e65 repl-session 54.82.169.150 :ubuntu :os-version nil :id us-east-1/i-36fc6e65]
ACTION: pallet.actions/exec-script* of type script executed on target
  FORM:
    (pallet.actions/exec-script* "ls -la /")
  SCRIPT:
    | ls -la /
nil

;; we want to see the session before and after as a default
(set-repl-options {:print-settings-before true :print-settings-after true})

;; now we want to actually run the same code as before on the target node and see what happens
 (step-lift (plan-fn (exec-script "ls -la /")(crate/assoc-settings :mongodb [:cluster false])))
12:35:49.540 [operate-96] INFO  pallet.ssh.execute - 54.82.169.150 22
SESSION:
NODE: repl-session-36fc6e65 IP: 54.82.169.150 GROUP: :repl-session
nil

PHASES: configure
GROUPS: repl-session
ACTIONS:
  PHASE configure:
    GROUP repl-session:
      NODE 54.82.169.150:
        ACTION ON NODE:
          SCRIPT:
          | #!/usr/bin/env bash
          | set -h
          | ls -la /
          | exit $?
          EXIT CODE: 0
          OUTPUT:
          | total 84
          | drwxr-xr-x 22 root root  4096 May 29 18:08 .
          | drwxr-xr-x 22 root root  4096 May 29 18:08 ..
          | drwxr-xr-x  2 root root  4096 Feb 26 03:35 bin
          | drwxr-xr-x  3 root root  4096 Feb 26 03:35 boot
          | drwxr-xr-x 13 root root  3920 May 29 18:08 dev
          | drwxr-xr-x 89 root root  4096 May 29 18:09 etc
          | drwxr-xr-x  4 root root  4096 May 29 18:09 home
          | lrwxrwxrwx  1 root root    34 Feb 26 03:35 initrd.img -> /boot/initrd.img-3.11.0-17-generic
          | drwxr-xr-x 20 root root  4096 Feb 26 03:34 lib
          | drwxr-xr-x  2 root root  4096 Feb 26 03:33 lib64
          | drwx------  2 root root 16384 Feb 26 03:35 lost+found
          | drwxr-xr-x  2 root root  4096 Feb 26 03:33 media
          | drwxr-xr-x  3 root root  4096 Jan 13 07:37 mnt
          | drwxr-xr-x  2 root root  4096 Feb 26 03:33 opt
          | dr-xr-xr-x 85 root root     0 May 29 18:08 proc
          | drwx------  3 root root  4096 May 29 18:08 root
          | drwxr-xr-x 17 root root   640 May 29 19:35 run
          | drwxr-xr-x  2 root root  4096 Feb 26 03:35 sbin
          | drwxr-xr-x  2 root root  4096 Feb 26 03:33 srv
          | dr-xr-xr-x 13 root root     0 May 29 18:08 sys
          | drwxrwxrwt  4 root root  4096 May 29 19:35 tmp
          | drwxr-xr-x 10 root root  4096 Feb 26 03:33 usr
          | drwxr-xr-x 13 root root  4096 Feb 26 03:35 var
          | lrwxrwxrwx  1 root root    30 Feb 26 03:35 vmlinuz -> boot/vmlinuz-3.11.0-17-generic
SESSION:
NODE: repl-session-36fc6e65 IP: 54.82.169.150 GROUP: :repl-session
{:mongodb {nil {:cluster false}}}

phases)

```clojure
(use 'pallet.repl)
(use 'pallet.api)
(use 'pallet.actions)
(require '[pallet.crate :as crate])

(def c (compute-service :aws))

;; initiate session
(start-repl-session c {:image {:image-id "us-east-1/ami-89181be0"}})

;; do a mock run of a plan function
(explain-step (plan-fn (exec-script "ls -la /")(crate/assoc-settings :mongodb [:cluster false])))

NODE: [repl-session-36fc6e65 repl-session 54.82.169.150 :ubuntu :os-version nil :id us-east-1/i-36fc6e65]
ACTION: pallet.actions/exec-script* of type script executed on target
  FORM:
    (pallet.actions/exec-script* "ls -la /")
  SCRIPT:
    | ls -la /
nil

 (step-lift (plan-fn (exec-script "ls -la /")(crate/assoc-settings :mongodb [:cluster false])))
12:35:49.540 [operate-96] INFO  pallet.ssh.execute - 54.82.169.150 22
SESSION:
NODE: repl-session-36fc6e65 IP: 54.82.169.150 GROUP: :repl-session
nil

PHASES: configure
GROUPS: repl-session
ACTIONS:
  PHASE configure:
    GROUP repl-session:
      NODE 54.82.169.150:
        ACTION ON NODE:
          SCRIPT:
          | #!/usr/bin/env bash
          | set -h
          | ls -la /
          | exit $?
          EXIT CODE: 0
          OUTPUT:
          | total 84
          | drwxr-xr-x 22 root root  4096 May 29 18:08 .
          | drwxr-xr-x 22 root root  4096 May 29 18:08 ..
          | drwxr-xr-x  2 root root  4096 Feb 26 03:35 bin
          | drwxr-xr-x  3 root root  4096 Feb 26 03:35 boot
          | drwxr-xr-x 13 root root  3920 May 29 18:08 dev
          | drwxr-xr-x 89 root root  4096 May 29 18:09 etc
          | drwxr-xr-x  4 root root  4096 May 29 18:09 home
          | lrwxrwxrwx  1 root root    34 Feb 26 03:35 initrd.img -> /boot/initrd.img-3.11.0-17-generic
          | drwxr-xr-x 20 root root  4096 Feb 26 03:34 lib
          | drwxr-xr-x  2 root root  4096 Feb 26 03:33 lib64
          | drwx------  2 root root 16384 Feb 26 03:35 lost+found
          | drwxr-xr-x  2 root root  4096 Feb 26 03:33 media
          | drwxr-xr-x  3 root root  4096 Jan 13 07:37 mnt
          | drwxr-xr-x  2 root root  4096 Feb 26 03:33 opt
          | dr-xr-xr-x 85 root root     0 May 29 18:08 proc
          | drwx------  3 root root  4096 May 29 18:08 root
          | drwxr-xr-x 17 root root   640 May 29 19:35 run
          | drwxr-xr-x  2 root root  4096 Feb 26 03:35 sbin
          | drwxr-xr-x  2 root root  4096 Feb 26 03:33 srv
          | dr-xr-xr-x 13 root root     0 May 29 18:08 sys
          | drwxrwxrwt  4 root root  4096 May 29 19:35 tmp
          | drwxr-xr-x 10 root root  4096 Feb 26 03:33 usr
          | drwxr-xr-x 13 root root  4096 Feb 26 03:35 var
          | lrwxrwxrwx  1 root root    30 Feb 26 03:35 vmlinuz -> boot/vmlinuz-3.11.0-17-generic
SESSION:
NODE: repl-session-36fc6e65 IP: 54.82.169.150 GROUP: :repl-session
{:mongodb {nil {:cluster false}}}
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant