0

whoamiローカル マシンで user として実行しようとしていますpalletが、 user として実行したいようdeadghostです。

(ns localhost.idk
  (:require (pallet [compute :as compute]
                    [api :as api]
                    [actions :as actions])))

(def my-data-center
  (compute/instantiate-provider
   "node-list"
   :node-list [["localhost" "whoami" "127.0.0.1" :ubuntu]]))

(def user-pallet
  (api/make-user "pallet"
                 :password "pallet"
                 :sudo-password nil
                 :public-key-path "/home/deadghost/.ssh/id_rsa.pub"
                 :private-key-path "/home/deadghost/.ssh/id_rsa"
                 :passphrase "my-ssh-passphrase-here"))

(pallet.api/lift
 (pallet.api/group-spec
  "whoami"
  :phases {:configure (api/plan-fn
                       (pallet.actions/exec-script
                        ("whoami")))})
 :compute my-data-center
 :user user-pallet)

の戻り値lift。出力はdeadghost次のとおりです。

{:initial-plan-state {:pallet.action/action-options {}},
 :environment
 {:compute #<NodeList pallet.compute.node_list.NodeList@b63e98>,
  :user
  {:username "pallet",
   :public-key-path "/home/deadghost/.ssh/id_rsa.pub",
   :private-key-path "/home/deadghost/.ssh/id_rsa",
   :public-key nil,
   :private-key nil,
   :passphrase "my-ssh-passphrase-here",
   :password "pallet",
   :sudo-password nil,
   :no-sudo nil,
   :sudo-user nil,
   :state-root nil,
   :state-group nil}},
 :results
 ({:target
   {:group-name :whoami,
    :default-phases [:configure],
    :phases
    {:pallet/os
     #<api$lift_STAR_$fn__14140 pallet.api$lift_STAR_$fn__14140@1db467f>,
     :configure
     #<idk$eval14723$fn__14725 localhost.idk$eval14723$fn__14725@baacb>},
    :group-names #{:whoami},
    :node
    {:name "localhost",
     :group-name "whoami",
     :ip "127.0.0.1",
     :os-family :ubuntu,
     :os-version nil,
     :id "localhost-127-0-0-1",
     :ssh-port 22,
     :private-ip nil,
     :is-64bit true,
     :running true,
     :service #<NodeList pallet.compute.node_list.NodeList@b63e98>,
     :hardware nil,
     :proxy nil,
     :image-user nil}},
   :target-type nil,
   :plan-state
   {:host
    {"localhost-127-0-0-1"
     {:pallet/os
      {nil
       {:context "os: ",
        :action-symbol clj-action13784,
        :id "Ubuntu",
        :release "14.04",
        :mach "i686",
        :rev "3.13.0-39-generic",
        :os "Linux",
        :os-family :ubuntu,
        :os-version "14.04"}}}},
    :pallet.action/action-options {}},
   :result
   ({:err "",
     :out "pallet:x:1001:1001:,,,:/home/pallet:/bin/bash\n",
     :exit 0,
     :flags #{},
     :flag-values {},
     :script
     "#!/usr/bin/env bash\nmkdir -p /home/deadghost || exit 1\ncd /home/deadghost\nset -h\nif getent passwd pallet; then :;else /usr/sbin/useradd pallet;fi\nexit $?",
     :action-symbol pallet.actions/user,
     :context nil}
    {:err "",
     :out "deadghost\n", <------------ OUTPUTS DEADGHOST INSTEAD OF PALLET
     :exit 0,
     :flags #{},
     :flag-values {},
     :script
     "#!/usr/bin/env bash\nmkdir -p /home/deadghost || exit 1\ncd /home/deadghost\nset -h\nwhoami\nexit $?",
     :action-symbol pallet.actions/exec-script*,
     :context nil}),
   :phase :configure}),
 :targets
 ({:group-name :whoami,
   :default-phases [:configure],
   :phases
   {:pallet/os
    #<api$lift_STAR_$fn__14140 pallet.api$lift_STAR_$fn__14140@1db467f>,
    :configure
    #<idk$eval14723$fn__14725 localhost.idk$eval14723$fn__14725@baacb>},
   :group-names #{:whoami},
   :node
   {:name "localhost",
    :group-name "whoami",
    :ip "127.0.0.1",
    :os-family :ubuntu,
    :os-version nil,
    :id "localhost-127-0-0-1",
    :ssh-port 22,
    :private-ip nil,
    :is-64bit true,
    :running true,
    :service #<NodeList pallet.compute.node_list.NodeList@b63e98>,
    :hardware nil,
    :proxy nil,
    :image-user nil}}),
 :plan-state
 {:node-values
  {nv14946
   {:err "",
    :out "pallet:x:1001:1001:,,,:/home/pallet:/bin/bash\n",
    :exit 0,
    :flags #{},
    :flag-values {},
    :script
    "#!/usr/bin/env bash\nmkdir -p /home/deadghost || exit 1\ncd /home/deadghost\nset -h\nif getent passwd pallet; then :;else /usr/sbin/useradd pallet;fi\nexit $?",
    :action-symbol pallet.actions/user,
    :context nil},
   nv14945
   {:err "",
    :out "deadghost\n",
    :exit 0,
    :flags #{},
    :flag-values {},
    :script
    "#!/usr/bin/env bash\nmkdir -p /home/deadghost || exit 1\ncd /home/deadghost\nset -h\nwhoami\nexit $?",
    :action-symbol pallet.actions/exec-script*,
    :context nil},
   nv14933
   {:id "Ubuntu",
    :release "14.04",
    :mach "i686",
    :rev "3.13.0-39-generic",
    :os "Linux",
    :os-family :ubuntu,
    :os-version "14.04",
    :action-symbol clj-action13784,
    :context "os: "},
   nv14932
   {:os-version "14.04",
    :os-family :ubuntu,
    :os "Linux",
    :rev "3.13.0-39-generic",
    :mach "i686",
    :release "14.04",
    :id "Ubuntu",
    :action-symbol clj-action13784,
    :context "os: "},
   nv14931
   {:release "14.04",
    :id "Ubuntu",
    :os-family :ubuntu,
    :os-version "14.04",
    :action-symbol clj-action13760,
    :context "os: infer-distro: "},
   nv14930
   {:err "",
    :out "{\n:id \"Ubuntu\"\n:release \"14.04\"\n}\n",
    :exit 0,
    :flags #{},
    :flag-values {},
    :script
    "#!/usr/bin/env bash\nmkdir -p /home/deadghost || exit 1\ncd /home/deadghost\nset -h\nif [ -e /etc/debconf_version ]; then\nID=$(cat /etc/redhat-release | egrep -o -e '^[A-Za-z ]+release' | sed -e 's/ release//')\nRELEASE=$(lsb_release -s -r)\nfi\nif [ -e /etc/lsb-release ]; then\nsource /etc/lsb-release\nID=${DISTRIB_ID}\nRELEASE=${DISTRIB_RELEASE}\nfi\nif [ -e /etc/redhat-release ]; then\nID=$(cat /etc/redhat-release | egrep -o -e '^[A-Za-z ]+release' | sed -e 's/ release//')\nRELEASE=$(cat /etc/redhat-release | sed -e 's/.*release//' | sed -e 's/[^0-9.]//g')\nfi\nif [ -e /etc/SUSE-release ]; then\nID=$(cat /etc/SUSE-release | tr ' ' | sed -e 's/VERSION.*//')\nRELEASE=$(cat /etc/SUSE-release | tr ' ' | sed -e 's/.*= //')\nfi\nif [ -e /etc/mandrake-release ]; then\nID=Mandrake\nRELEASE=$(cat /etc/mandrake-release | sed -e 's/.*release //' | sed -e 's/ .*//')\nfi\necho {\necho   :id '\"'${ID:-unknown}'\"'\necho   :release '\"'${RELEASE:-unknown}'\"'\necho }\n\nexit $?",
    :action-symbol pallet.actions/exec-script*,
    :context "os: infer-distro: "},
   nv14929
   {:mach "i686",
    :rev "3.13.0-39-generic",
    :os "Linux",
    :os-family :linux,
    :os-version "3.13.0-39-generic",
    :action-symbol clj-action13735,
    :context "os: infer-os: "},
   nv14928
   {:err "",
    :out
    "{\n:os \"Linux\"\n:rev \"3.13.0-39-generic\"\n:mach \"i686\"\n}\n",
    :exit 0,
    :flags #{},
    :flag-values {},
    :script
    "#!/usr/bin/env bash\nmkdir -p /home/deadghost || exit 1\ncd /home/deadghost\nset -h\necho {\necho   :os '\"'$(uname -s)'\"'\necho   :rev '\"'$(uname -r)'\"'\necho   :mach '\"'$(uname -m)'\"'\necho }\n\nexit $?",
    :action-symbol pallet.actions/exec-script*,
    :context "os: infer-os: "}},
  :host
  {"localhost-127-0-0-1"
   {:pallet/os
    {nil
     {:context "os: ",
      :action-symbol clj-action13784,
      :id "Ubuntu",
      :release "14.04",
      :mach "i686",
      :rev "3.13.0-39-generic",
      :os "Linux",
      :os-family :ubuntu,
      :os-version "14.04"}}}},
  :pallet.action/action-options {}}}

から取得pallet.log

2014-11-13 08:08:04,333 DEBUG [operate-92] p.c.operations lift :phases [:pallet/os :settings] :targets [:ed]
2014-11-13 08:08:04,342 DEBUG [operate-94] p.c.primitives build-and-execute-phase :pallet/os on 1 target(s)
2014-11-13 08:08:04,342 DEBUG [operate-94] p.c.api-impl target-os-details node {:packager :apt, :os-family :ubuntu} detected {}
2014-11-13 08:08:04,342 DEBUG [operate-94] p.c.api-impl Script context: [:ubuntu :apt]
2014-11-13 08:08:04,345 DEBUG [operate-94] p.core.api environment-execution-settings {:compute #<NodeList pallet.compute.node_list.NodeList@1ac4ccd>, :user #pallet.core.user.User{:username "pallet", :public-key-path "/home/deadghost/.ssh/id_rsa.pub", :private-key-path "/home/deadghost/.ssh/id_rsa", :public-key nil, :private-key nil, :passphrase "my-ssh-passphrase-here", :password "pallet", :sudo-password nil, :no-sudo nil, :sudo-user nil, :state-root nil, :state-group nil}}
2014-11-13 08:08:04,345 DEBUG [operate-94] p.core.api Env user pallet.core.user.User@d8ec4e52
2014-11-13 08:08:04,346 DEBUG [operate-94] p.c.api-impl target-os-details node {:packager :apt, :os-family :ubuntu} detected {}
2014-11-13 08:08:04,346 DEBUG [operate-94] p.c.api-impl Script context: [:ubuntu :apt]
2014-11-13 08:08:04,347 DEBUG [operate-94] p.l.execute  localhost ==>  -----------------------------------------
2014-11-13 08:08:04,347 DEBUG [operate-94] p.l.execute  localhost ==> #!/usr/bin/env bash
2014-11-13 08:08:04,347 DEBUG [operate-94] p.l.execute  localhost ==> mkdir -p /home/deadghost || exit 1
2014-11-13 08:08:04,347 DEBUG [operate-94] p.l.execute  localhost ==> cd /home/deadghost
2014-11-13 08:08:04,347 DEBUG [operate-94] p.l.execute  localhost ==> set -h
2014-11-13 08:08:04,347 DEBUG [operate-94] p.l.execute  localhost ==> echo {
2014-11-13 08:08:04,348 DEBUG [operate-94] p.l.execute  localhost ==> echo   :os '"'$(uname -s)'"'
2014-11-13 08:08:04,348 DEBUG [operate-94] p.l.execute  localhost ==> echo   :rev '"'$(uname -r)'"'
2014-11-13 08:08:04,348 DEBUG [operate-94] p.l.execute  localhost ==> echo   :mach '"'$(uname -m)'"'
2014-11-13 08:08:04,348 DEBUG [operate-94] p.l.execute  localhost ==> echo }
2014-11-13 08:08:04,348 DEBUG [operate-94] p.l.execute  localhost ==> 
2014-11-13 08:08:04,348 DEBUG [operate-94] p.l.execute  localhost ==> exit $?
2014-11-13 08:08:04,348 DEBUG [operate-94] p.l.execute  localhost ==> ------------------------------------------
2014-11-13 08:08:04,358 DEBUG [operate-94] p.l.execute localhost <== ----------------------------------------
2014-11-13 08:08:04,358 DEBUG [operate-94] p.script-builder {:script-dir "/home/deadghost", :default-script-prefix :no-sudo}
2014-11-13 08:08:04,358 DEBUG [operate-94] p.script-builder prefix kw :no-sudo
2014-11-13 08:08:04,358 DEBUG [operate-94] p.l.execute localhost {:env-cmd "/usr/bin/env", :env nil, :env-fwd [:SSH_AUTH_SOCK], :prefix nil, :execv ("/bin/bash" "/tmp/pallet8828719639020449641script")}
2014-11-13 08:08:05,360 DEBUG [operate-94] p.execute localhost   <== {
2014-11-13 08:08:05,360 DEBUG [operate-94] p.execute localhost   <== :os "Linux"
2014-11-13 08:08:05,360 DEBUG [operate-94] p.execute localhost   <== :rev "3.13.0-39-generic"
2014-11-13 08:08:05,360 DEBUG [operate-94] p.execute localhost   <== :mach "i686"
2014-11-13 08:08:05,360 DEBUG [operate-94] p.execute localhost   <== }
2014-11-13 08:08:05,361 DEBUG [operate-94] p.l.execute localhost <== ----------------------------------------
2014-11-13 08:08:05,362 DEBUG [operate-94] p.l.execute clojure-on-origin pallet.crate.os$infer_os$action__4279__auto___direct__13736$clj_action13735__13737@15798c9
2014-11-13 08:08:05,367 DEBUG [operate-94] p.l.execute  localhost ==>  -----------------------------------------
2014-11-13 08:08:05,367 DEBUG [operate-94] p.l.execute  localhost ==> #!/usr/bin/env bash
2014-11-13 08:08:05,367 DEBUG [operate-94] p.l.execute  localhost ==> mkdir -p /home/deadghost || exit 1
2014-11-13 08:08:05,367 DEBUG [operate-94] p.l.execute  localhost ==> cd /home/deadghost
2014-11-13 08:08:05,367 DEBUG [operate-94] p.l.execute  localhost ==> set -h
2014-11-13 08:08:05,367 DEBUG [operate-94] p.l.execute  localhost ==> if [ -e /etc/debconf_version ]; then
2014-11-13 08:08:05,367 DEBUG [operate-94] p.l.execute  localhost ==> ID=$(cat /etc/redhat-release | egrep -o -e '^[A-Za-z ]+release' | sed -e 's/ release//')
2014-11-13 08:08:05,367 DEBUG [operate-94] p.l.execute  localhost ==> RELEASE=$(lsb_release -s -r)
2014-11-13 08:08:05,368 DEBUG [operate-94] p.l.execute  localhost ==> fi
2014-11-13 08:08:05,368 DEBUG [operate-94] p.l.execute  localhost ==> if [ -e /etc/lsb-release ]; then
2014-11-13 08:08:05,368 DEBUG [operate-94] p.l.execute  localhost ==> source /etc/lsb-release
2014-11-13 08:08:05,368 DEBUG [operate-94] p.l.execute  localhost ==> ID=${DISTRIB_ID}
2014-11-13 08:08:05,368 DEBUG [operate-94] p.l.execute  localhost ==> RELEASE=${DISTRIB_RELEASE}
2014-11-13 08:08:05,368 DEBUG [operate-94] p.l.execute  localhost ==> fi
2014-11-13 08:08:05,368 DEBUG [operate-94] p.l.execute  localhost ==> if [ -e /etc/redhat-release ]; then
2014-11-13 08:08:05,368 DEBUG [operate-94] p.l.execute  localhost ==> ID=$(cat /etc/redhat-release | egrep -o -e '^[A-Za-z ]+release' | sed -e 's/ release//')
2014-11-13 08:08:05,368 DEBUG [operate-94] p.l.execute  localhost ==> RELEASE=$(cat /etc/redhat-release | sed -e 's/.*release//' | sed -e 's/[^0-9.]//g')
2014-11-13 08:08:05,368 DEBUG [operate-94] p.l.execute  localhost ==> fi
2014-11-13 08:08:05,368 DEBUG [operate-94] p.l.execute  localhost ==> if [ -e /etc/SUSE-release ]; then
2014-11-13 08:08:05,368 DEBUG [operate-94] p.l.execute  localhost ==> ID=$(cat /etc/SUSE-release | tr ' ' | sed -e 's/VERSION.*//')
2014-11-13 08:08:05,368 DEBUG [operate-94] p.l.execute  localhost ==> RELEASE=$(cat /etc/SUSE-release | tr ' ' | sed -e 's/.*= //')
2014-11-13 08:08:05,368 DEBUG [operate-94] p.l.execute  localhost ==> fi
2014-11-13 08:08:05,368 DEBUG [operate-94] p.l.execute  localhost ==> if [ -e /etc/mandrake-release ]; then
2014-11-13 08:08:05,368 DEBUG [operate-94] p.l.execute  localhost ==> ID=Mandrake
2014-11-13 08:08:05,368 DEBUG [operate-94] p.l.execute  localhost ==> RELEASE=$(cat /etc/mandrake-release | sed -e 's/.*release //' | sed -e 's/ .*//')
2014-11-13 08:08:05,368 DEBUG [operate-94] p.l.execute  localhost ==> fi
2014-11-13 08:08:05,368 DEBUG [operate-94] p.l.execute  localhost ==> echo {
2014-11-13 08:08:05,368 DEBUG [operate-94] p.l.execute  localhost ==> echo   :id '"'${ID:-unknown}'"'
2014-11-13 08:08:05,368 DEBUG [operate-94] p.l.execute  localhost ==> echo   :release '"'${RELEASE:-unknown}'"'
2014-11-13 08:08:05,368 DEBUG [operate-94] p.l.execute  localhost ==> echo }
2014-11-13 08:08:05,368 DEBUG [operate-94] p.l.execute  localhost ==> 
2014-11-13 08:08:05,368 DEBUG [operate-94] p.l.execute  localhost ==> exit $?
2014-11-13 08:08:05,368 DEBUG [operate-94] p.l.execute  localhost ==> ------------------------------------------
2014-11-13 08:08:05,371 DEBUG [operate-94] p.l.execute localhost <== ----------------------------------------
2014-11-13 08:08:05,371 DEBUG [operate-94] p.script-builder {:script-dir "/home/deadghost", :default-script-prefix :no-sudo}
2014-11-13 08:08:05,371 DEBUG [operate-94] p.script-builder prefix kw :no-sudo
2014-11-13 08:08:05,372 DEBUG [operate-94] p.l.execute localhost {:env-cmd "/usr/bin/env", :env nil, :env-fwd [:SSH_AUTH_SOCK], :prefix nil, :execv ("/bin/bash" "/tmp/pallet4201262849437841643script")}
2014-11-13 08:08:06,373 DEBUG [operate-94] p.execute localhost   <== {
2014-11-13 08:08:06,373 DEBUG [operate-94] p.execute localhost   <== :id "Ubuntu"
2014-11-13 08:08:06,374 DEBUG [operate-94] p.execute localhost   <== :release "14.04"
2014-11-13 08:08:06,374 DEBUG [operate-94] p.execute localhost   <== }
2014-11-13 08:08:06,375 DEBUG [operate-94] p.l.execute localhost <== ----------------------------------------
2014-11-13 08:08:06,375 DEBUG [operate-94] p.l.execute clojure-on-origin pallet.crate.os$infer_distro$action__4279__auto___direct__13761$clj_action13760__13762@1c412ce
2014-11-13 08:08:06,375 DEBUG [operate-94] p.l.execute clojure-on-origin pallet.crate.os$os$action__4279__auto___direct__13785$clj_action13784__13786@1aebe5f
2014-11-13 08:08:06,376 DEBUG [operate-94] p.l.execute clojure-on-origin pallet.actions.direct.settings$eval12391$assoc_settings_direct__12393$fn__12395@1546d95
2014-11-13 08:08:06,386 DEBUG [operate-93] p.c.primitives build-and-execute-phase :settings on 1 target(s)
2014-11-13 08:08:06,397 DEBUG [operate-94] p.c.operations lift-partitions :phases [:configure] :targets [:ed]
2014-11-13 08:08:06,400 DEBUG [operate-93] p.c.operations lift :phases [:configure] :targets [:ed]
2014-11-13 08:08:06,404 DEBUG [operate-94] p.c.primitives build-and-execute-phase :configure on 1 target(s)
2014-11-13 08:08:06,405 DEBUG [operate-94] p.c.api-impl target-os-details node {:packager :apt, :os-family :ubuntu} detected {:os-version "14.04", :os-family :ubuntu}
2014-11-13 08:08:06,405 DEBUG [operate-94] p.c.api-impl Script context: [:ubuntu :apt :ubuntu-14.04]
2014-11-13 08:08:06,412 DEBUG [operate-92] p.core.api environment-execution-settings {:compute #<NodeList pallet.compute.node_list.NodeList@1ac4ccd>, :user #pallet.core.user.User{:username "pallet", :public-key-path "/home/deadghost/.ssh/id_rsa.pub", :private-key-path "/home/deadghost/.ssh/id_rsa", :public-key nil, :private-key nil, :passphrase "my-ssh-passphrase-here", :password "pallet", :sudo-password nil, :no-sudo nil, :sudo-user nil, :state-root nil, :state-group nil}}
2014-11-13 08:08:06,413 DEBUG [operate-92] p.core.api Env user pallet.core.user.User@d8ec4e52
2014-11-13 08:08:06,415 DEBUG [operate-92] p.c.api-impl target-os-details node {:packager :apt, :os-family :ubuntu} detected {:os-version "14.04", :os-family :ubuntu}
2014-11-13 08:08:06,415 DEBUG [operate-92] p.c.api-impl Script context: [:ubuntu :apt :ubuntu-14.04]
2014-11-13 08:08:06,416 DEBUG [operate-92] p.l.execute  localhost ==>  -----------------------------------------
2014-11-13 08:08:06,417 DEBUG [operate-92] p.l.execute  localhost ==> #!/usr/bin/env bash
2014-11-13 08:08:06,417 DEBUG [operate-92] p.l.execute  localhost ==> mkdir -p /home/deadghost || exit 1
2014-11-13 08:08:06,417 DEBUG [operate-92] p.l.execute  localhost ==> cd /home/deadghost
2014-11-13 08:08:06,417 DEBUG [operate-92] p.l.execute  localhost ==> set -h
2014-11-13 08:08:06,417 DEBUG [operate-92] p.l.execute  localhost ==> whoami
2014-11-13 08:08:06,417 DEBUG [operate-92] p.l.execute  localhost ==> exit $?
2014-11-13 08:08:06,417 DEBUG [operate-92] p.l.execute  localhost ==> ------------------------------------------
2014-11-13 08:08:06,421 DEBUG [operate-92] p.l.execute localhost <== ----------------------------------------
2014-11-13 08:08:06,421 DEBUG [operate-92] p.script-builder {:script-dir "/home/deadghost", :default-script-prefix :no-sudo}
2014-11-13 08:08:06,421 DEBUG [operate-92] p.script-builder prefix kw :no-sudo
2014-11-13 08:08:06,421 DEBUG [operate-92] p.l.execute localhost {:env-cmd "/usr/bin/env", :env nil, :env-fwd [:SSH_AUTH_SOCK], :prefix nil, :execv ("/bin/bash" "/tmp/pallet3318318864438163863script")}
2014-11-13 08:08:07,427 DEBUG [operate-92] p.execute localhost   <== deadghost
2014-11-13 08:08:07,428 DEBUG [operate-92] p.l.execute localhost <== ----------------------------------------
4

1 に答える 1