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

sudo-user in local context #58

Closed
justone opened this issue May 17, 2020 · 1 comment
Closed

sudo-user in local context #58

justone opened this issue May 17, 2020 · 1 comment
Labels
bug Something isn't working

Comments

@justone
Copy link

justone commented May 17, 2020

With the following on Ubuntu 18.04:

#!/usr/bin/env spire

(require '[spire.modules :as modules])

(modules/local
  (modules/sudo-user
    {:user "root"
     :password "supersecretpass"}
    (modules/apt :update)
    (modules/apt :install ["smartmontools" "tree"])))

I get:

$ spire -f setup.clj
Exception in thread "main" clojure.lang.ExceptionInfo: Assert failed: Unknown response from sudo id in sudo-id exit: 1 err: "sh: 1: supersecretpass: not found\n[sudo] password for nate: \n"
 out: ""

false [at setup.clj, line 8, column 1] {:type :sci/error, :line 8, :column 1, :message "Assert failed: Unknown response from sudo id in sudo-id exit: 1 err: \"sh: 1: supersecretpass: not found\\n[sudo] password for nate: \\n\"\n out: \"\"\n\nfalse [at setup.clj, line 8, column 1]"}
        at sci.impl.utils$rethrow_with_location_of_node.invokeStatic(utils.cljc:74)
        at sci.impl.utils$rethrow_with_location_of_node.invoke(utils.cljc:58)
        at sci.impl.interpreter$eval_call.invokeStatic(interpreter.cljc:518)
        at sci.impl.interpreter$eval_call.invoke(interpreter.cljc:498)
        at sci.impl.interpreter$interpret.invokeStatic(interpreter.cljc:547)
        at sci.impl.interpreter$interpret.invoke(interpreter.cljc:530)
        at sci.impl.interpreter$eval_form.invokeStatic(interpreter.cljc:588)
        at sci.impl.interpreter$eval_form.invoke(interpreter.cljc:579)
        at sci.impl.interpreter$eval_string_STAR_.invokeStatic(interpreter.cljc:598)
        at sci.impl.interpreter$eval_string_STAR_.invoke(interpreter.cljc:593)
        at sci.impl.interpreter$eval_string$fn__4572.invoke(interpreter.cljc:610)
        at sci.impl.interpreter$eval_string.invokeStatic(interpreter.cljc:607)
        at sci.impl.interpreter$eval_string.invoke(interpreter.cljc:603)
        at sci.core$eval_string.invokeStatic(core.cljc:178)
        at sci.core$eval_string.invoke(core.cljc:141)
        at spire.eval$evaluate.invokeStatic(eval.clj:79)
        at spire.eval$evaluate.invoke(eval.clj:69)
        at spire.core$_main.invokeStatic(core.clj:77)
        at spire.core$_main.doInvoke(core.clj:56)
        at clojure.lang.RestFn.applyTo(RestFn.java:137)
        at spire.core.main(Unknown Source)
Caused by: java.lang.AssertionError: Assert failed: Unknown response from sudo id in sudo-id exit: 1 err: "sh: 1: supersecretpass: not found\n[sudo] password for nate: \n"
 out: ""

false
        at spire.module.sudo$sudo_id.invokeStatic(sudo.clj:137)
        at spire.module.sudo$sudo_id.invoke(sudo.clj:116)
        at sci.impl.interpreter$fn_call.invokeStatic(interpreter.cljc:463)
        at sci.impl.interpreter$fn_call.invoke(interpreter.cljc:463)
        at sci.impl.interpreter$eval_call.invokeStatic(interpreter.cljc:514)
        at sci.impl.interpreter$eval_call.invoke(interpreter.cljc:498)
        at sci.impl.interpreter$interpret.invokeStatic(interpreter.cljc:547)
        at sci.impl.interpreter$interpret.invoke(interpreter.cljc:530)
        at sci.impl.interpreter$eval_let.invokeStatic(interpreter.cljc:83)
        at sci.impl.interpreter$eval_let.doInvoke(interpreter.cljc:59)
        at clojure.lang.RestFn.applyTo(RestFn.java:142)
        at clojure.core$apply.invokeStatic(core.clj:667)
        at clojure.core$apply.invoke(core.clj:660)
        at sci.impl.interpreter$eval_special_call.invokeStatic(interpreter.cljc:471)
        at sci.impl.interpreter$eval_special_call.invoke(interpreter.cljc:465)
        at sci.impl.interpreter$eval_call.invokeStatic(interpreter.cljc:505)
        at sci.impl.interpreter$eval_call.invoke(interpreter.cljc:498)
        at sci.impl.interpreter$interpret.invokeStatic(interpreter.cljc:547)
        at sci.impl.interpreter$interpret.invoke(interpreter.cljc:530)
        at sci.impl.interpreter$eval_let.invokeStatic(interpreter.cljc:83)
        at sci.impl.interpreter$eval_let.doInvoke(interpreter.cljc:59)
        at clojure.lang.RestFn.applyTo(RestFn.java:142)
        at clojure.core$apply.invokeStatic(core.clj:667)
        at clojure.core$apply.invoke(core.clj:660)
        at sci.impl.interpreter$eval_special_call.invokeStatic(interpreter.cljc:471)
        at sci.impl.interpreter$eval_special_call.invoke(interpreter.cljc:465)
        at sci.impl.interpreter$eval_call.invokeStatic(interpreter.cljc:505)
        at sci.impl.interpreter$eval_call.invoke(interpreter.cljc:498)
        at sci.impl.interpreter$interpret.invokeStatic(interpreter.cljc:547)
        at sci.impl.interpreter$interpret.invoke(interpreter.cljc:530)
        at sci.impl.interpreter$eval_do_STAR_$fn__4340.invoke(interpreter.cljc:420)
        at sci.impl.interpreter$eval_do_STAR_.invokeStatic(interpreter.cljc:420)
        at sci.impl.interpreter$eval_do_STAR_.invoke(interpreter.cljc:417)
        at sci.impl.interpreter$eval_do.invokeStatic(interpreter.cljc:430)
        at sci.impl.interpreter$eval_do.invoke(interpreter.cljc:427)
        at sci.impl.interpreter$eval_special_call.invokeStatic(interpreter.cljc:467)
        at sci.impl.interpreter$eval_special_call.invoke(interpreter.cljc:465)
        at sci.impl.interpreter$eval_call.invokeStatic(interpreter.cljc:505)
        at sci.impl.interpreter$eval_call.invoke(interpreter.cljc:498)
        at sci.impl.interpreter$interpret.invokeStatic(interpreter.cljc:547)
        at sci.impl.interpreter$interpret.invoke(interpreter.cljc:530)
        at sci.impl.interpreter$eval_do_STAR_$fn__4340.invoke(interpreter.cljc:420)
        at sci.impl.interpreter$eval_do_STAR_.invokeStatic(interpreter.cljc:420)
        at sci.impl.interpreter$eval_do_STAR_.invoke(interpreter.cljc:417)
        at sci.impl.interpreter$eval_do.invokeStatic(interpreter.cljc:430)
        at sci.impl.interpreter$eval_do.invoke(interpreter.cljc:427)
        at sci.impl.interpreter$eval_special_call.invokeStatic(interpreter.cljc:467)
        at sci.impl.interpreter$eval_special_call.invoke(interpreter.cljc:465)
        at sci.impl.interpreter$eval_call.invokeStatic(interpreter.cljc:505)
        at sci.impl.interpreter$eval_call.invoke(interpreter.cljc:498)
        at sci.impl.interpreter$interpret.invokeStatic(interpreter.cljc:547)
        at sci.impl.interpreter$interpret.invoke(interpreter.cljc:530)
        at sci.impl.interpreter$eval_try.invokeStatic(interpreter.cljc:285)
        at sci.impl.interpreter$eval_try.invoke(interpreter.cljc:280)
        at sci.impl.interpreter$interpret.invokeStatic(interpreter.cljc:548)
        at sci.impl.interpreter$interpret.invoke(interpreter.cljc:530)
        at sci.impl.interpreter$eval_let.invokeStatic(interpreter.cljc:83)
        at sci.impl.interpreter$eval_let.doInvoke(interpreter.cljc:59)
        at clojure.lang.RestFn.applyTo(RestFn.java:142)
        at clojure.core$apply.invokeStatic(core.clj:667)
        at clojure.core$apply.invoke(core.clj:660)
        at sci.impl.interpreter$eval_special_call.invokeStatic(interpreter.cljc:471)
        at sci.impl.interpreter$eval_special_call.invoke(interpreter.cljc:465)
        at sci.impl.interpreter$eval_call.invokeStatic(interpreter.cljc:505)
        ... 18 more

The weird thing is, if I run a sudo command and then re-run spire, it works:

$ sudo ls
[sudo] password for nate:
plex  README.md  setup.clj  smokeping  sync-docker
$ spire -f setup.clj
setup.clj:9 (modules/apt :update) local
setup.clj:10 (modules/apt :install ["smartmontools" "tree"]) local
{:err "",
 :exit 0,
 :out "Reading package lists...\nBuilding dependency tree...\nReading state information...\nsmartmontools is already the newest version (6.5+svn4324-1).\ntree is already the newest version (1.7.0-5).\nThe following package was automatically installed and is no longer required:\n  liblua5.1-0\nUse 'sudo apt autoremove' to remove it.\n0 upgraded, 0 newly installed, 0 to remove and 55 not upgraded.\n",
 :out-lines ["Reading package lists..."
             "Building dependency tree..."
             "Reading state information..."
             "smartmontools is already the newest version (6.5+svn4324-1)."
             "tree is already the newest version (1.7.0-5)."
             "The following package was automatically installed and is no longer required:"
             "  liblua5.1-0"
             "Use 'sudo apt autoremove' to remove it."
             "0 upgraded, 0 newly installed, 0 to remove and 55 not upgraded."],
 :packages {:installed 0, :removed 0, :upgraded 0},
 :result :ok}

I hope this helps. Thanks for spire!

@retrogradeorbit retrogradeorbit added the bug Something isn't working label May 18, 2020
@retrogradeorbit
Copy link
Member

fixed in 0.1.0-alpha.11

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants