Application cookbook/bitbucket problem

Hello,

I am trying to install a local application from bitbucket to a Ubuntu
14.04 virtualBox VM. I keep getting an error on the keys for the ssh
connection, but I can’t see what is wrong with how I specify the private
key. I have attached the Vagrant and cookbook files I am using. My
cookbook is called CIRAdataApp and I am installing it to our local chef
server.

Also note that the repository is under a bitbucket group account,
cira-dpc, but that my ssh key is under my personal account. But, I have
been able to check out the repository using this key pair with git
commands on my desktop.

And here is the last part of the chef-client output with the git error:

Running handlers:
[2014-09-16T16:54:12+00:00] ERROR: Running exception handlers
Running handlers complete
[2014-09-16T16:54:12+00:00] ERROR: Exception handlers complete
[2014-09-16T16:54:12+00:00] FATAL: Stacktrace dumped to
/var/chef/cache/chef-stacktrace.out
Chef Client failed. 3 resources updated in 25.022724174 seconds
[2014-09-16T16:54:12+00:00] ERROR: deploy_revision[CIRAdataApp]
(/var/chef/cache/cookbooks/application/providers/default.rb line 122)
had an error: Mixlib::ShellOut::ShellCommandFailed: Expected process to
exit with [0], but received ‘128’
---- Begin output of git ls-remote
"git@bitbucket.org:cira-dpc/api.ciradata.edu.git" “HEAD” ----
STDOUT:
STDERR: Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
---- End output of git ls-remote
"git@bitbucket.org:cira-dpc/api.ciradata.edu.git" “HEAD” ----
Ran git ls-remote "git@bitbucket.org:cira-dpc/api.ciradata.edu.git"
“HEAD” returned 128
[2014-09-16T16:54:12+00:00] FATAL: Chef::Exceptions::ChildConvergeError:
Chef run process exited unsuccessfully (exit code 1)

Any help would be appreciated.

Thanks,
Jim

I'm unsure of what I'll say, but is not your key linked to a specific account ? Here the account used to list is git, it sounds wrong to me for bitbucket or github.

I did not check if there's a clone user attribute for the application provider si it's just a guess I may be awfully wrong :wink:

Envoyé à partir de mon smartphone Sony Xperia™

---- Jim Fluke a écrit ----

Hello,

I am trying to install a local application from bitbucket to a Ubuntu
14.04 virtualBox VM. I keep getting an error on the keys for the ssh
connection, but I can't see what is wrong with how I specify the private
key. I have attached the Vagrant and cookbook files I am using. My
cookbook is called CIRAdataApp and I am installing it to our local chef
server.

Also note that the repository is under a bitbucket group account,
cira-dpc, but that my ssh key is under my personal account. But, I have
been able to check out the repository using this key pair with git
commands on my desktop.

And here is the last part of the chef-client output with the git error:

Running handlers:
[2014-09-16T16:54:12+00:00] ERROR: Running exception handlers
Running handlers complete
[2014-09-16T16:54:12+00:00] ERROR: Exception handlers complete
[2014-09-16T16:54:12+00:00] FATAL: Stacktrace dumped to
/var/chef/cache/chef-stacktrace.out
Chef Client failed. 3 resources updated in 25.022724174 seconds
[2014-09-16T16:54:12+00:00] ERROR: deploy_revision[CIRAdataApp]
(/var/chef/cache/cookbooks/application/providers/default.rb line 122)
had an error: Mixlib::ShellOut::ShellCommandFailed: Expected process to
exit with [0], but received '128'
---- Begin output of git ls-remote
"git@bitbucket.org:cira-dpc/api.ciradata.edu.git" "HEAD" ----
STDOUT:
STDERR: Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
---- End output of git ls-remote
"git@bitbucket.org:cira-dpc/api.ciradata.edu.git" "HEAD" ----
Ran git ls-remote "git@bitbucket.org:cira-dpc/api.ciradata.edu.git"
"HEAD" returned 128
[2014-09-16T16:54:12+00:00] FATAL: Chef::Exceptions::ChildConvergeError:
Chef run process exited unsuccessfully (exit code 1)

Any help would be appreciated.

Thanks,
Jim

Can you replace:

deploy_key "-----BEGIN RSA PRIVATE KEY-----
MIIEogIBAAKCAQEAyfREehADgLn/Bh27ePPDDkB78R9WpRD0Rr9ENJh4hpNwzSt2
.
.
.
uR60aI0Yfa68/LT/zP+TJjyu3iR69jVpHBxL/f2lEnGMydzJZ0s=
-----END RSA PRIVATE KEY-----"

With:

deploy_key "/path/to/id_rsa"
(or whatever the file is called)?

On Tue, Sep 16, 2014 at 1:40 PM, Jim Fluke james.fluke@colostate.edu
wrote:

Hello,

I am trying to install a local application from bitbucket to a Ubuntu
14.04 virtualBox VM. I keep getting an error on the keys for the ssh
connection, but I can't see what is wrong with how I specify the private
key. I have attached the Vagrant and cookbook files I am using. My cookbook
is called CIRAdataApp and I am installing it to our local chef server.

Also note that the repository is under a bitbucket group account,
cira-dpc, but that my ssh key is under my personal account. But, I have
been able to check out the repository using this key pair with git commands
on my desktop.

And here is the last part of the chef-client output with the git error:

Running handlers:
[2014-09-16T16:54:12+00:00] ERROR: Running exception handlers
Running handlers complete
[2014-09-16T16:54:12+00:00] ERROR: Exception handlers complete
[2014-09-16T16:54:12+00:00] FATAL: Stacktrace dumped to
/var/chef/cache/chef-stacktrace.out
Chef Client failed. 3 resources updated in 25.022724174 seconds
[2014-09-16T16:54:12+00:00] ERROR: deploy_revision[CIRAdataApp]
(/var/chef/cache/cookbooks/application/providers/default.rb line 122) had
an error: Mixlib::ShellOut::ShellCommandFailed: Expected process to exit
with [0], but received '128'
---- Begin output of git ls-remote "git@bitbucket.org:cira-dpc/api.ciradata.edu.git"
"HEAD" ----
STDOUT:
STDERR: Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
---- End output of git ls-remote "git@bitbucket.org:cira-dpc/api.ciradata.edu.git"
"HEAD" ----
Ran git ls-remote "git@bitbucket.org:cira-dpc/api.ciradata.edu.git"
"HEAD" returned 128
[2014-09-16T16:54:12+00:00] FATAL: Chef::Exceptions::ChildConvergeError:
Chef run process exited unsuccessfully (exit code 1)

Any help would be appreciated.

Thanks,
Jim

That is the URI bitbucket gave me. And I can use it successfully to
clone the repository on the command line. But, for the command line
clone I set up ~/.ssh/config with this:
Host bitbucketid
HostName bitbucket.org
IdentityFile ~/.ssh/bitbucket_apps_key

and then use:
git@bitbucketid:cira-dpc/api.ciradata.edu.git

to access the repository. I was thinking the application cookbook would
do something similar for me under the hood. There is nothing in the
documentation that says I need to do more than what I have done.
However, I could add a block to my recipe to create ~vagrant/.ssh files
like this and maybe that is what I need to try. I'll see how it goes.

Thanks,
Jim

On 09/16/2014 01:02 PM, Tensibai Zhaoying wrote:

I'm unsure of what I'll say, but is not your key linked to a specific
account ? Here the account used to list is git, it sounds wrong to me
for bitbucket or github.

I did not check if there's a clone user attribute for the application
provider si it's just a guess I may be awfully wrong :wink:

Envoyé à partir de mon smartphone Sony Xperia™

---- Jim Fluke a écrit ----

Hello,

I am trying to install a local application from bitbucket to a Ubuntu
14.04 tel:14.04 virtualBox VM. I keep getting an error on the keys
for the ssh
connection, but I can't see what is wrong with how I specify the private
key. I have attached the Vagrant and cookbook files I am using. My
cookbook is called CIRAdataApp and I am installing it to our local chef
server.

Also note that the repository is under a bitbucket group account,
cira-dpc, but that my ssh key is under my personal account. But, I have
been able to check out the repository using this key pair with git
commands on my desktop.

And here is the last part of the chef-client output with the git error:

Running handlers:
[2014-09-16 tel:2014-09-16T16:54:12+00:00] ERROR: Running exception
handlers
Running handlers complete
[2014-09-16 tel:2014-09-16T16:54:12+00:00] ERROR: Exception handlers
complete
[2014-09-16 tel:2014-09-16T16:54:12+00:00] FATAL: Stacktrace dumped to
/var/chef/cache/chef-stacktrace.out
Chef Client failed. 3 resources updated in 25.022724174
tel:25.022724174 seconds
[2014-09-16 tel:2014-09-16T16:54:12+00:00] ERROR:
deploy_revision[CIRAdataApp]
(/var/chef/cache/cookbooks/application/providers/default.rb line 122
tel:122)
had an error: Mixlib::ShellOut::ShellCommandFailed: Expected process to
exit with [0], but received '128 tel:128'
---- Begin output of git ls-remote
"git@bitbucket.org
mailto:git@bitbucket.org:cira-dpc/api.ciradata.edu
http://api.ciradata.edu.git" "HEAD" ----
STDOUT:
STDERR: Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
---- End output of git ls-remote
"git@bitbucket.org
mailto:git@bitbucket.org:cira-dpc/api.ciradata.edu
http://api.ciradata.edu.git" "HEAD" ----
Ran git ls-remote "git@bitbucket.org
mailto:git@bitbucket.org:cira-dpc/api.ciradata.edu
http://api.ciradata.edu.git"
"HEAD" returned 128 tel:128
[2014-09-16 tel:2014-09-16T16:54:12+00:00] FATAL:
Chef::Exceptions::ChildConvergeError:
Chef run process exited unsuccessfully (exit code 1)

Any help would be appreciated.

Thanks,
Jim

I tried that and it made no difference.

Thanks for responding.
Jim

On 09/16/2014 01:38 PM, Fabien Delpierre wrote:

Can you replace:

deploy_key "-----BEGIN RSA PRIVATE KEY-----
MIIEogIBAAKCAQEAyfREehADgLn/Bh27ePPDDkB78R9WpRD0Rr9ENJh4hpNwzSt2
.
.
.
uR60aI0Yfa68/LT/zP+TJjyu3iR69jVpHBxL/f2lEnGMydzJZ0s=
-----END RSA PRIVATE KEY-----"

With:

deploy_key "/path/to/id_rsa"
(or whatever the file is called)?

On Tue, Sep 16, 2014 at 1:40 PM, Jim Fluke <james.fluke@colostate.edu
mailto:james.fluke@colostate.edu> wrote:

Hello,

I am trying to install a local application from bitbucket to a
Ubuntu 14.04 virtualBox VM. I keep getting an error on the keys
for the ssh connection, but I can't see what is wrong with how I
specify the private key. I have attached the Vagrant and cookbook
files I am using. My cookbook is called CIRAdataApp and I am
installing it to our local chef server.

Also note that the repository is under a bitbucket group account,
cira-dpc, but that my ssh key is under my personal account. But, I
have been able to check out the repository using this key pair
with git commands on my desktop.

And here is the last part of the chef-client output with the git
error:

Running handlers:
[2014-09-16T16:54:12+00:00] ERROR: Running exception handlers
Running handlers complete
[2014-09-16T16:54:12+00:00] ERROR: Exception handlers complete
[2014-09-16T16:54:12+00:00] FATAL: Stacktrace dumped to
/var/chef/cache/chef-stacktrace.out
Chef Client failed. 3 resources updated in 25.022724174 seconds
[2014-09-16T16:54:12+00:00] ERROR: deploy_revision[CIRAdataApp]
(/var/chef/cache/cookbooks/application/providers/default.rb line
122) had an error: Mixlib::ShellOut::ShellCommandFailed: Expected
process to exit with [0], but received '128'
---- Begin output of git ls-remote
"git@bitbucket.org:cira-dpc/api.ciradata.edu.git" "HEAD" ----
STDOUT:
STDERR: Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
---- End output of git ls-remote
"git@bitbucket.org:cira-dpc/api.ciradata.edu.git" "HEAD" ----
Ran git ls-remote
"git@bitbucket.org:cira-dpc/api.ciradata.edu.git" "HEAD" returned 128
[2014-09-16T16:54:12+00:00] FATAL:
Chef::Exceptions::ChildConvergeError: Chef run process exited
unsuccessfully (exit code 1)


Any help would be appreciated.

Thanks,
Jim

If what you're doing is not running under your own user for whatever
reason, it is possible that having the private key in your own ~/.ssh
folder would be useless to the process, although then I don't know why it
also wouldn't take the private key when you're passing its value to the
attribute as plain text.
But on that note, in your attachment containing the edited private key, it
looks like you pasted the raw private key with carriage returns as the
deploy_key attribute. You may want to replace the carriage returns with \n
-- if you look at GitHub - chef-boneyard/chef-api: DEPRECATED: A tiny Chef API client with minimal dependencies and just search for
"begin public key", you'll see what I'm talking about.

On Tue, Sep 16, 2014 at 5:57 PM, Jim Fluke james.fluke@colostate.edu
wrote:

I tried that and it made no difference.

Thanks for responding.
Jim

On 09/16/2014 01:38 PM, Fabien Delpierre wrote:

Can you replace:

deploy_key "-----BEGIN RSA PRIVATE KEY-----
MIIEogIBAAKCAQEAyfREehADgLn/Bh27ePPDDkB78R9WpRD0Rr9ENJh4hpNwzSt2
.
.
.
uR60aI0Yfa68/LT/zP+TJjyu3iR69jVpHBxL/f2lEnGMydzJZ0s=
-----END RSA PRIVATE KEY-----"

With:

deploy_key "/path/to/id_rsa"
(or whatever the file is called)?

On Tue, Sep 16, 2014 at 1:40 PM, Jim Fluke james.fluke@colostate.edu
wrote:

Hello,

I am trying to install a local application from bitbucket to a Ubuntu
14.04 virtualBox VM. I keep getting an error on the keys for the ssh
connection, but I can't see what is wrong with how I specify the private
key. I have attached the Vagrant and cookbook files I am using. My cookbook
is called CIRAdataApp and I am installing it to our local chef server.

Also note that the repository is under a bitbucket group account,
cira-dpc, but that my ssh key is under my personal account. But, I have
been able to check out the repository using this key pair with git commands
on my desktop.

And here is the last part of the chef-client output with the git error:

Running handlers:
[2014-09-16T16:54:12+00:00] ERROR: Running exception handlers
Running handlers complete
[2014-09-16T16:54:12+00:00] ERROR: Exception handlers complete
[2014-09-16T16:54:12+00:00] FATAL: Stacktrace dumped to
/var/chef/cache/chef-stacktrace.out
Chef Client failed. 3 resources updated in 25.022724174 seconds
[2014-09-16T16:54:12+00:00] ERROR: deploy_revision[CIRAdataApp]
(/var/chef/cache/cookbooks/application/providers/default.rb line 122) had
an error: Mixlib::ShellOut::ShellCommandFailed: Expected process to exit
with [0], but received '128'
---- Begin output of git ls-remote
"git@bitbucket.org:cira-dpc/api.ciradata.edu.git"
<git@bitbucket.org:cira-dpc/api.ciradata.edu.git> "HEAD" ----
STDOUT:
STDERR: Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
---- End output of git ls-remote
"git@bitbucket.org:cira-dpc/api.ciradata.edu.git"
<git@bitbucket.org:cira-dpc/api.ciradata.edu.git> "HEAD" ----
Ran git ls-remote "git@bitbucket.org:cira-dpc/api.ciradata.edu.git"
<git@bitbucket.org:cira-dpc/api.ciradata.edu.git> "HEAD" returned 128
[2014-09-16T16:54:12+00:00] FATAL: Chef::Exceptions::ChildConvergeError:
Chef run process exited unsuccessfully (exit code 1)

Any help would be appreciated.

Thanks,
Jim

That worked! Thank you Fabien.

Note that I had sort of tried that before. I substituted the newline
with '\n' after the BEGIN line and before the END line, but I just
joined the lines in the key together - removing the newlines. That does
not work, you have to substitute them all.

Thanks again,
Jim

On 09/16/2014 06:28 PM, Fabien Delpierre wrote:

If what you're doing is not running under your own user for whatever
reason, it is possible that having the private key in your own ~/.ssh
folder would be useless to the process, although then I don't know why
it also wouldn't take the private key when you're passing its value to
the attribute as plain text.
But on that note, in your attachment containing the edited private
key, it looks like you pasted the raw private key with carriage
returns as the deploy_key attribute. You may want to replace the
carriage returns with \n -- if you look at
GitHub - chef-boneyard/chef-api: DEPRECATED: A tiny Chef API client with minimal dependencies and just search for "begin
public key", you'll see what I'm talking about.

On Tue, Sep 16, 2014 at 5:57 PM, Jim Fluke <james.fluke@colostate.edu
mailto:james.fluke@colostate.edu> wrote:

I tried that and it made no difference.

Thanks for responding.
Jim


On 09/16/2014 01:38 PM, Fabien Delpierre wrote:
Can you replace:

deploy_key "-----BEGIN RSA PRIVATE KEY-----
MIIEogIBAAKCAQEAyfREehADgLn/Bh27ePPDDkB78R9WpRD0Rr9ENJh4hpNwzSt2
    .
    .
    .
uR60aI0Yfa68/LT/zP+TJjyu3iR69jVpHBxL/f2lEnGMydzJZ0s=
    -----END RSA PRIVATE KEY-----"

With:

deploy_key "/path/to/id_rsa"
(or whatever the file is called)?


On Tue, Sep 16, 2014 at 1:40 PM, Jim Fluke
<james.fluke@colostate.edu <mailto:james.fluke@colostate.edu>> wrote:

    Hello,

    I am trying to install a local application from bitbucket to
    a Ubuntu 14.04 virtualBox VM. I keep getting an error on the
    keys for the ssh connection, but I can't see what is wrong
    with how I specify the private key. I have attached the
    Vagrant and cookbook files I am using. My cookbook is called
    CIRAdataApp and I am installing it to our local chef server.

    Also note that the repository is under a bitbucket group
    account, cira-dpc, but that my ssh key is under my personal
    account. But, I have been able to check out the repository
    using this key pair with git commands on my desktop.

    And here is the last part of the chef-client output with the
    git error:

    Running handlers:
    [2014-09-16T16:54:12+00:00] ERROR: Running exception handlers
    Running handlers complete
    [2014-09-16T16:54:12+00:00] ERROR: Exception handlers complete
    [2014-09-16T16:54:12+00:00] FATAL: Stacktrace dumped to
    /var/chef/cache/chef-stacktrace.out
    Chef Client failed. 3 resources updated in 25.022724174 seconds
    [2014-09-16T16:54:12+00:00] ERROR:
    deploy_revision[CIRAdataApp]
    (/var/chef/cache/cookbooks/application/providers/default.rb
    line 122) had an error: Mixlib::ShellOut::ShellCommandFailed:
    Expected process to exit with [0], but received '128'
    ---- Begin output of git ls-remote
    "git@bitbucket.org:cira-dpc/api.ciradata.edu.git"
    <mailto:git@bitbucket.org:cira-dpc/api.ciradata.edu.git>
    "HEAD" ----
    STDOUT:
    STDERR: Permission denied (publickey).
    fatal: Could not read from remote repository.

    Please make sure you have the correct access rights
    and the repository exists.
    ---- End output of git ls-remote
    "git@bitbucket.org:cira-dpc/api.ciradata.edu.git"
    <mailto:git@bitbucket.org:cira-dpc/api.ciradata.edu.git>
    "HEAD" ----
    Ran git ls-remote
    "git@bitbucket.org:cira-dpc/api.ciradata.edu.git"
    <mailto:git@bitbucket.org:cira-dpc/api.ciradata.edu.git>
    "HEAD" returned 128
    [2014-09-16T16:54:12+00:00] FATAL:
    Chef::Exceptions::ChildConvergeError: Chef run process exited
    unsuccessfully (exit code 1)


    Any help would be appreciated.

    Thanks,
    Jim

Great!
I'm no expert but I think your experience with trying to just remove the
carriage returns and with it still failing makes sense, as the
whitespace/new line characters are required by the formatting of a PEM file.

On Wed, Sep 17, 2014 at 11:27 AM, Jim Fluke james.fluke@colostate.edu
wrote:

That worked! Thank you Fabien.

Note that I had sort of tried that before. I substituted the newline with
'\n' after the BEGIN line and before the END line, but I just joined the
lines in the key together - removing the newlines. That does not work, you
have to substitute them all.

Thanks again,
Jim

On 09/16/2014 06:28 PM, Fabien Delpierre wrote:

If what you're doing is not running under your own user for whatever
reason, it is possible that having the private key in your own ~/.ssh
folder would be useless to the process, although then I don't know why it
also wouldn't take the private key when you're passing its value to the
attribute as plain text.
But on that note, in your attachment containing the edited private key,
it looks like you pasted the raw private key with carriage returns as the
deploy_key attribute. You may want to replace the carriage returns with \n
-- if you look at GitHub - chef-boneyard/chef-api: DEPRECATED: A tiny Chef API client with minimal dependencies and just search
for "begin public key", you'll see what I'm talking about.

On Tue, Sep 16, 2014 at 5:57 PM, Jim Fluke james.fluke@colostate.edu
wrote:

I tried that and it made no difference.

Thanks for responding.
Jim

On 09/16/2014 01:38 PM, Fabien Delpierre wrote:

Can you replace:

deploy_key "-----BEGIN RSA PRIVATE KEY-----
MIIEogIBAAKCAQEAyfREehADgLn/Bh27ePPDDkB78R9WpRD0Rr9ENJh4hpNwzSt2
.
.
.
uR60aI0Yfa68/LT/zP+TJjyu3iR69jVpHBxL/f2lEnGMydzJZ0s=
-----END RSA PRIVATE KEY-----"

With:

deploy_key "/path/to/id_rsa"
(or whatever the file is called)?

On Tue, Sep 16, 2014 at 1:40 PM, Jim Fluke james.fluke@colostate.edu
wrote:

Hello,

I am trying to install a local application from bitbucket to a Ubuntu
14.04 virtualBox VM. I keep getting an error on the keys for the ssh
connection, but I can't see what is wrong with how I specify the private
key. I have attached the Vagrant and cookbook files I am using. My cookbook
is called CIRAdataApp and I am installing it to our local chef server.

Also note that the repository is under a bitbucket group account,
cira-dpc, but that my ssh key is under my personal account. But, I have
been able to check out the repository using this key pair with git commands
on my desktop.

And here is the last part of the chef-client output with the git error:

Running handlers:
[2014-09-16T16:54:12+00:00] ERROR: Running exception handlers
Running handlers complete
[2014-09-16T16:54:12+00:00] ERROR: Exception handlers complete
[2014-09-16T16:54:12+00:00] FATAL: Stacktrace dumped to
/var/chef/cache/chef-stacktrace.out
Chef Client failed. 3 resources updated in 25.022724174 seconds
[2014-09-16T16:54:12+00:00] ERROR: deploy_revision[CIRAdataApp]
(/var/chef/cache/cookbooks/application/providers/default.rb line 122) had
an error: Mixlib::ShellOut::ShellCommandFailed: Expected process to exit
with [0], but received '128'
---- Begin output of git ls-remote
"git@bitbucket.org:cira-dpc/api.ciradata.edu.git"
<git@bitbucket.org:cira-dpc/api.ciradata.edu.git> "HEAD" ----
STDOUT:
STDERR: Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
---- End output of git ls-remote
"git@bitbucket.org:cira-dpc/api.ciradata.edu.git"
<git@bitbucket.org:cira-dpc/api.ciradata.edu.git> "HEAD" ----
Ran git ls-remote "git@bitbucket.org:cira-dpc/api.ciradata.edu.git"
<git@bitbucket.org:cira-dpc/api.ciradata.edu.git> "HEAD" returned 128
[2014-09-16T16:54:12+00:00] FATAL: Chef::Exceptions::ChildConvergeError:
Chef run process exited unsuccessfully (exit code 1)

Any help would be appreciated.

Thanks,
Jim