killme2008 / killme2008/clojure-control

run example (deftask :create-dir []) : no tty present

Open
#24 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Clojure
Stars
137
Forks
10
PR merge metrics
No merged PRs in 30d

Description

I am trying to create a folder, using the task as specified in the `guide` :

```
(deftask :create-dir []
(if (not (exists? (str (:path @config))))
(ssh (sudo (str "mkdir -p " (:path @config))))))
```

I get an error :

```
sudo: no tty present and no askpass program specified
```

After googling for the error, I get to this SO post :

http://stackoverflow.com/questions/21659637/how-to-fix-sudo-no-tty-present-and-no-askpass-program-specified-error

And I add `:ssh-options` to my local cluster :

```
(defcluster :local
:clients [{:host "localhost" :user "nha"}]
:ssh-options "-t")
```

This time I get :

```
localhost:ssh: -t test -e /var/dev/clojure-cms
localhost:stderr: Pseudo-terminal will not be allocated because stdin is not a terminal.
localhost:exit: 1
localhost:ssh: -t sudo mkdir -p /var/dev/clojure-cms ;
localhost:stderr: Pseudo-terminal will not be allocated because stdin is not a terminal.
sudo: no tty present and no askpass program specified
```

Following the trail, I get to this post :
http://stackoverflow.com/questions/7114990/pseudo-terminal-will-not-be-allocated-because-stdin-is-not-a-terminal

I try "-t -t", and "-T", none of these work.

```
localhost:ssh: -t -t test -e /var/dev/clojure-cms
localhost:stderr: ssh: illegal option --
```

And :

```
localhost:ssh: -T test -e /var/dev/clojure-cms
localhost:exit: 1
localhost:ssh: -T sudo mkdir -p /var/dev/clojure-cms ;
localhost:stderr: sudo: no tty present and no askpass program specified
localhost:exit: 1
```

What should I do ?

_Note :_ I am on osx 10.10.5, tried from a bash and zsh shell in case it matters.

Contributor guide

No contributing guide indexed for this repository

Research direction

The issue points to the guide's `deftask :create-dir` example and the `defcluster :local` `:ssh-options` setting; start by reproducing it on macOS with the shown commands and inspect how those SSH options are passed. Done means the example can create the directory without the no-TTY/askpass errors, or the guide documents a confirmed workaround.

Written by the indexing model from the issue text.

Assessment

Tech stack
clojure
Domain
devops
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.