Giter Club home page Giter Club logo

knife-joyent's Introduction

Knife Joyent

This is a Knife plug-in for Joyent CloudAPI. This plug-in gives knife the ability to create, bootstrap, and manage servers on the Joyent Public Cloud as well as cloud providers powered by Joyent's Private Cloud product offering.

For more information on Joyent CloudAPI, see: CloudAPI Documentation.

Installation

With chef already installed (> 0.10.0):

chef gem install knife-joyent

Usage

For a list of commands:

knife joyent --help

Currently available commands:

knife joyent flavor list <options>
knife joyent image list <options>
knife joyent key add -f <keyfile> -k <name>
knife joyent key delete <name>
knife joyent key list
knife joyent network list
knife joyent server create (options)
knife joyent server delete <server_id>
knife joyent server list <options>
knife joyent server reboot <server_id>
knife joyent server resize <server_id> -f <flavor>
knife joyent server start <server_id>
knife joyent server stop <server_id>
knife joyent server pricing
knife joyent server metadata update <server_id> -m <json>
knife joyent server metadata delete <server_id> <options>
knife joyent snapshot create <server_id> <snapshot_name>
knife joyent snapshot delete <server_id> <snapshot_name>
knife joyent snapshot list <server_id>
knife joyent tag create <server_id> <tag> <value>
knife joyent tag delete <server_id> <tag>
knife joyent tag delete <server_id> -A
knife joyent tag list <server_id>

# requires joyent_version 7.1+
knife joyent server fw enable <server_id>
knife joyent server fw disable <server_id>
knife joyent fw get <fwrule_id>
knife joyent fw create (options)
knife joyent fw list <server_id>
knife joyent fw update <rule_id> (options)
knife joyent fw delete <rule_id> (options)

Example Usage

The following command will provision an Ubuntu 12.04 with 1GB of memory and bootstrap it with chef

# knife joyent server create \
    --joyent-api-version '~7.0' \
    --flavor "Small 1GB" \
    --networks 42325ea0-eb62-44c1-8eb6-0af3e2f83abc,c8cde927-6277-49ca-82a3-741e8b23b02f \
    --image d2ba0f30-bbe8-11e2-a9a2-6bc116856d85 \
    --node-name 'cookbuntu0' \
    --server-name 'cookbuntu0'

Creating machine cookbuntu0
Waiting for Server to be Provisioned
....................
Bootstrap IP Address 165.225.150.239
No user defined in knife config for provision tagging -- continuing
Created machine:
ID: 9cdf6324-9769-4134-a7a8-a575c7dfcc13
Name: cookbuntu0
State: running
Type: virtualmachine
Dataset: sdc:jpc:ubuntu-12.04:2.4.2
IPs: 165.225.150.239 10.12.29.210
Waiting for server to fully initialize...
Waiting for SSH to come up on: 165.225.150.239
SSHD accepting connections on 165.225.150.239: banner is SSH-2.0-OpenSSH_5.9p1 Debian-5ubuntu1

Bootstrapping Chef on 165.225.150.239
...

Please see knife joyent server create --help for more options

Configuration

The following options can be specified in your knife configuration file knife.rb

Required

You can authenticate against CloudAPI using either:

an ssh key (recommended)

knife[:joyent_username] = "Your Joyent CloudAPI username"
knife[:joyent_keyname] = "Name of key stored on Joyent"
knife[:joyent_keyfile] = "/path/to/your/private/key"

# Optional / not-recommended -- defaults to using ssh-agent
knife[:joyent_keyphrase] = "mypassphrase"

or username and password

knife[:joyent_username] = "Your Joyent CloudAPI username"
knife[:joyent_password] = "Your Joyent CloudAPI password"

When authenticating with your ssh key (which we highly recommend), knife-joyent will attempt to use ssh-agent to sign the request using the key configured with knife[:joyent_keyname]. If no ssh-agent is present or if the specified identity isn't found in the agent, you may be prompted for a pass-phrase. If you do not want to use an ssh-agent, you may optionally configure knife[:joyent_passphrase] to automatically unlock the key for authentication.

Optional Configuration

joyent_api_url

Specifies a custom CloudAPI endpoint, this is required if you want to manage machines located in another datacenter or if you want to interface with any CloudAPI instance powered by SmartDataCenter.

Defaults to us-sw-1

Available datacenters (currently) are:

https://eu-ams-1.api.joyent.com
https://us-west-1.api.joyent.com
https://us-sw-1.api.joyent.com
https://us-east-1.api.joyent.com

# Defaults to https://us-sw-1.api.joyent.com/
knife[:joyent_api_url] = "https://us-sw-1.api.joyent.com/"

joyent_metadata

Metadata to apply to each provisioned machine via the Metadata API. This should take the form of a hash with a single level of nesting. See the Metadata API for more info.

knife[:joyent_metadata] = {
  "some_data" => "value"
}

joyent_version

By default, knife-joyent will use the version of the Joyent Cloud API that fog prefers. This can be overridden in knife.rb as follows:

knife[:joyent_version] = "~7.1"

Some command line options to knife-joyent subcommands may depend on the Joyent API version set.

joyent_verify_peer

Set to false to Disable SSL Certificate verification, required if the CloudAPI instance uses a self-signed cert. (Default: true)

provisioner

Machines provisioned will be tagged with key provisioner containing the value specified. This is useful for tracking source of provisions for accounts where machines are provisioned by/from different sources / users.

Contributors

Bootstrap template for smartos

To bootstrap chef on SmartOS, use the script provided at joyent/smartmachine_cookbooks which sets up chef-client with SMF and installs the basic essentials.

License

Copyright 2015 Joyent, Inc

Author: Kevin Chan [email protected]

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

knife-joyent's People

Contributors

alainodea avatar bixu avatar brennentsmith avatar dwlf avatar ekristen avatar kigster avatar mdxp avatar namtzigla avatar numericillustration avatar pfmooney avatar robertosanchez avatar sax avatar stephenlauck avatar thekvn avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

knife-joyent's Issues

Unauthorized on Create Server

Hi, I'm currently working with Telefonica Instant Servers, which is a CloudAPI Platform. I'm trying automate all config, so I'm using knife-joyent. I'm new with the Joyent Platform btw.

When I'm creating a new server, I'm getting this error:

ERROR: Unexpected Error Occured:#<Excon::Errors::Unauthorized: Expected([200, 201, 202]) <=> Actual(401 Unauthorized)>

I think it is related to ssh authentication, because when change the knife.rb configuration to user/password, works almost perfect, because the new server is created, but it generates an error:

ERROR: Unexpected Error Occured:#<ArgumentError: Initialization parameters must be an attributes hash, got String "{\n  \"id\": \"72719afe-c573-4f34-96f6-909ec2efad91\",\n  \"name\": \"woker1.production\",\n  \"type\": \"smartmachine\",\n  \"state\": \"provisioning\",\n  \"dataset\": \"sdc:sdc:base64:13.1.0\",\n  \"ips\": [\n    \"5.255.146.220\"\n  ],\n  \"memory\": 512,\n  \"disk\": 15360,\n  \"metadata\": {},\n  \"created\": \"2013-06-05T15:22:16+00:00\",\n  \"updated\": \"2013-06-05T15:22:16+00:00\",\n  \"primaryIp\": \"5.255.146.220\"\n}">

The weird think is that using ssh key, other commands like server list works perfectly.

This is my knife.rb (with some values replaced.)

current_dir = File.dirname(__FILE__)
log_level                :info
log_location             STDOUT
node_name                "rrodrigu3z"
client_key               "#{current_dir}/rrodrigu3z.pem"
validation_client_name   "chef-validator"
validation_key           "#{current_dir}/validation.pem"
chef_server_url          "my_chef_server_url"
cache_type               'BasicFile'
cache_options(:path => "#{ENV['HOME']}/.chef/checksums" )
cookbook_path            "#{current_dir}/../cookbooks"

knife[:joyent_username] = 'username'
# knife[:joyent_password] = 'some_pwd'
knife[:joyent_keyname] = 'key_name_in_web_ui'
knife[:joyent_keyfile] = "#{ENV['HOME']}/.ssh/iservers_rsa"
knife[:joyent_api_url] = 'https://api-eu-lon-1.instantservers.telefonica.com'

This is the create server command:

knife joyent server create \
  --image 9eac5c0c-a941-11e2-a7dc-57a6b041988f \
  --flavor g1_standard_1cpu_512mb \
  -N woker1.test

Any ideas?
Thanks

Insane in the membrane error message when node name is in use

If I try to create a machine with a name that is already in use I get a very low-level exception. The error is part of the 409 Conflict, but is fairly carefully buried in the mix.

alain@alainodea:~/Documents/chef-repo$ knife joyent server create --run-list 'role[demo]' --flavor "Extra Small 512 MB" -I 9eac5c0c-a941-11e2-a7dc-57a6b041988f -d joyent-smartmachine -N "demo.example.net"
Creating machine demo.example.net
ERROR: Excon::Errors::Conflict: Expected([200, 201, 202]) <=> Actual(409 Conflict)
  request => {:retry_limit=>4, :read_timeout=>60, :idempotent=>false, :query=>nil, :retries_remaining=>4, :method=>"POST", :ssl_ca_file=>"/var/lib/gems/1.8/gems/excon-0.20.1/data/cacert.pem", :expects=>[200, 201, 202], :instrumentor_name=>"excon", :chunk_size=>1048576, :middlewares=>[Excon::Middleware::Expects, Excon::Middleware::Idempotent, Excon::Middleware::Instrumentor, Excon::Middleware::Mock], :mock=>false, :host=>"api.joyentcloud.com", :ssl_verify_peer=>true, :nonblock=>false, :port=>"443", :uri_parser=>URI, :password=>nil, :body=>"{\"dataset\":\"9eac5c0c-a941-11e2-a7dc-57a6b041988f\",\"package\":\"Extra Small 512 MB\",\"name\":\"demo.example.net\"}", :headers=>{"Date"=>"Mon, 06 May 2013 01:55:07 GMT", "Authorization"=>"REDACTED", "Accept"=>"application/json", "Host"=>"api.joyentcloud.com:443", "Content-Length"=>100, "X-Api-Version"=>"~6.5", "User-Agent"=>"fog/1.10.1", "Content-Type"=>"application/json"}, :connect_timeout=>60, :user=>nil, :path=>"/my/machines", :write_timeout=>60, :scheme=>"https"}
  response => #<Excon::Response:0x7f8789bb4fa0 @remote_ip="8.19.33.207", @body="{\"code\":\"InvalidArgument\",\"message\":\"name is already in use\"}", @status=409, @data={:status=>409, :remote_ip=>"8.19.33.207", :body=>"{\"code\":\"InvalidArgument\",\"message\":\"name is already in use\"}", :headers=>{"Content-MD5"=>"7Tf5DMtubaUB8+km2huflg==", "Date"=>"Mon, 06 May 2013 01:55:15 GMT", "Access-Control-Allow-Methods"=>"OPTIONS, HEAD, HEAD, HEAD, HEAD, HEAD, GET, GET, GET, GET, GET, POST, POST, POST, POST, POST", "Access-Control-Expose-Headers"=>"X-Api-Version, X-Request-Id, X-Response-Time", "Server"=>"SmartDataCenter", "Content-Length"=>"61", "X-Request-Id"=>"378d67a2-addd-4f19-ac20-34753b2bfe60", "Access-Control-Allow-Origin"=>"*", "X-Response-Time"=>"3370", "X-Api-Version"=>"6.5.0", "Access-Control-Allow-Headers"=>"Accept, Content-Type, Content-Length, Date, X-Api-Version", "Connection"=>"Keep-Alive", "Content-Type"=>"application/json"}}, @headers={"Content-MD5"=>"7Tf5DMtubaUB8+km2huflg==", "Date"=>"Mon, 06 May 2013 01:55:15 GMT", "Access-Control-Allow-Methods"=>"OPTIONS, HEAD, HEAD, HEAD, HEAD, HEAD, GET, GET, GET, GET, GET, POST, POST, POST, POST, POST", "Access-Control-Expose-Headers"=>"X-Api-Version, X-Request-Id, X-Response-Time", "Server"=>"SmartDataCenter", "Content-Length"=>"61", "X-Request-Id"=>"378d67a2-addd-4f19-ac20-34753b2bfe60", "Access-Control-Allow-Origin"=>"*", "X-Response-Time"=>"3370", "X-Api-Version"=>"6.5.0", "Access-Control-Allow-Headers"=>"Accept, Content-Type, Content-Length, Date, X-Api-Version", "Connection"=>"Keep-Alive", "Content-Type"=>"application/json"}>

If it printed the response body of the 409 Conflict it would be a huge step up in usability:

{"code":"InvalidArgument","message":"name is already in use"}

The gold in handling it with a non-zero response code and printing the JSON error message back to STDOUT is that the errors can be handled by the calling shell more easily.

I'll admit that the Excon::Errors::Conflict exception object is probably very useful when calling knife-joyent from Ruby code. Joe Armstrong says it well at http://joearms.github.io/2013/04/28/Fail-fast-noisely-and-politely.html. There should be the detailed dump for programmers, but it shouldn't leak out to end-users :)

Thanks,
Alain

Failure with uninitialized constant KnifeJoyent::Base (NameError)

Chef: 10.12.0
knife-joyent: 0.0.6
ruby 1.8.7 (2011-12-28 patchlevel 357) [universal-darwin11.0]

Knife-joyent fails to run with the following error. Is this an issue with 1.8 support?

blue:~ bkrueger$ knife joyent server list
/Library/Ruby/Gems/1.8/gems/knife-joyent-0.0.6/lib/chef/knife/joyent_server_create.rb:4: uninitialized constant KnifeJoyent::Base (NameError)
from /Library/Ruby/Gems/1.8/gems/chef-10.12.0/lib/chef/knife/core/subcommand_loader.rb:37:in load' from /Library/Ruby/Gems/1.8/gems/chef-10.12.0/lib/chef/knife/core/subcommand_loader.rb:37:inload_commands'
from /Library/Ruby/Gems/1.8/gems/chef-10.12.0/lib/chef/knife/core/subcommand_loader.rb:37:in each' from /Library/Ruby/Gems/1.8/gems/chef-10.12.0/lib/chef/knife/core/subcommand_loader.rb:37:inload_commands'
from /Library/Ruby/Gems/1.8/gems/chef-10.12.0/lib/chef/knife.rb:114:in load_commands' from /Library/Ruby/Gems/1.8/gems/chef-10.12.0/lib/chef/knife.rb:162:inrun'
from /Library/Ruby/Gems/1.8/gems/chef-10.12.0/lib/chef/application/knife.rb:123:in run' from /Library/Ruby/Gems/1.8/gems/chef-10.12.0/bin/knife:25 from /usr/bin/knife:19:inload'
from /usr/bin/knife:19

Hanging after SSH comes up

When I run something like

knife joyent server create -d smartos-ngz -r "recipe[ldap::client]" --flavor regular_1024 --image cf7e2f40-9276-11e2-af9a-0bad2233fb0b --node-name knife-test --private-network --server-name knife-test

Things will hang indefinitely after the SSHD OK message generated on line 279 in lib/chef/knife/joyent_server_create.rb. I've found that everything works fine if I comment out the chef debug message on like 280.

knife joyent server list fails when the dc contains machine with null name

knife joyent server list -VV
DEBUG: Using configuration from /Users/elw/.chef/knife.rb
/opt/local/lib/ruby1.9/gems/1.9.1/gems/knife-joyent-0.0.5/lib/chef/knife/joyent_server_list.rb:23:in `sort_by': comparison of NilClass with String failed (ArgumentError)
 from /opt/local/lib/ruby1.9/gems/1.9.1/gems/knife-joyent-0.0.5/lib/chef/knife/joyent_server_list.rb:23:in `run'
 from /opt/local/lib/ruby1.9/gems/1.9.1/gems/chef-0.10.10/lib/chef/knife.rb:402:in `run_with_pretty_exceptions'
 from /opt/local/lib/ruby1.9/gems/1.9.1/gems/chef-0.10.10/lib/chef/knife.rb:168:in `run'
 from /opt/local/lib/ruby1.9/gems/1.9.1/gems/chef-0.10.10/lib/chef/application/knife.rb:123:in `run'
 from /opt/local/lib/ruby1.9/gems/1.9.1/gems/chef-0.10.10/bin/knife:25:in `<top (required)>'
 from /opt/local/bin/knife:23:in `load'
 from /opt/local/bin/knife:23:in `<main>'

Support for sub-users?

Joyent allows for multiple sub-users on a single Joyent account. There is role-based access control that allows different users to have different API privileges.

I'm pretty new to Joyent, but I think this is a recent enough addition that this Knife plugin doesn't support it yet. Assuming that's the case, is this something that should be added to this plugin or to the Fog gem?

occasional password prompt for 'knife joyent server create'

On rare occasions when creating a VM I get prompted for a password for the initial bootstrap ssh connection. I definitely have ssh keys in place that work because this does not happen every time.

I've not experienced this with other knife VM plugins.

I have found that it does not matter what I enter at the prompt, the bootstrap continues successfully. So either the password prompt is completely bogus or a new ssh connection is attempted after satisfying the prompt and the ssh key now works.

My only guess is a possible race condition where the ssh connection is made before the authorized_keys file has been populated on the VM. Not sure how valid a guess this is.

Here's the output from one time this just happened with possibly sensitive information edited (I just mashed the keyboard and hit enter at the password prompt):

Creating machine XXX-XXX
Waiting for Server to be Provisioned
.....................................
Bootstrap IP Address XX.X.XXX.XXX
Updated tags for XXX-XXX
Name         Value      
provisioner  pmacdougall
Created machine:
ID: 0dc2237e-ded6-42e2-938d-ec2846504dff
Name: XXX-XXX
State: running
Type: virtualmachine
Dataset: sdc:sdc:centos-6:2.6.0
IPs: XX.X.XXX.XXX XX.XXX.X.X
Waiting for server to fully initialize...
Waiting for SSH to come up on: XX.X.XXX.XXX
.SSHD accepting connections on XX.X.XXX.XXX: banner is SSH-2.0-OpenSSH_5.3

Bootstrapping Chef on XX.X.XXX.XXX
Failed to authenticate root - trying password auth
Enter your password: 
XX.X.XXX.XXX --2014-03-21 23:40:55--  https://www.opscode.com/chef/install.sh
XX.X.XXX.XXX Resolving www.opscode.com... 184.106.28.90
XX.X.XXX.XXX Connecting to www.opscode.com|184.106.28.90|:443... connected.

I realize the plugin has handed over the "controls" at the point of the prompt, but thought I'd ask here since I've only seen this behavior with this plugin.

Has anyone else experienced this? It doesn't affect me much when I'm hands-on-keyboard but we have some automated scripting that will fail occasionally because of this.

--sudo flag is not passed to knife by the plugin?

Need sudo for canonical ubuntu images, but:

> knife joyent server create --image e28711b3-7f9c-47a7-be7f-ce07e9a99394 --flavor <flavor> --distro <distro>  --environment _default --node-name <name> --ssh-user ubuntu --sudo
Error: invalid option: --sudo

knife joyent server create -r "role[production],role[monitoring]" has errors

When running
knife joyent server create -r "role[production],role[monitoring]"

I get...

Bootstrapping Chef on XXXXXXX
64.30.132.241 --2012-07-13 22:47:33-- http://opscode.com/chef/install.sh
64.30.132.241 Resolving opscode.com (opscode.com)...
64.30.132.241 184.106.28.83
64.30.132.241 Connecting to opscode.com (opscode.com)|184.106.28.83|:80...
64.30.132.241 connected.
64.30.132.241 HTTP request sent, awaiting response...
64.30.132.241 301 Moved Permanently
64.30.132.241 Location: http://www.opscode.com/chef/install.sh [following]
64.30.132.241 --2012-07-13 22:47:34-- http://www.opscode.com/chef/install.sh
64.30.132.241 Resolving www.opscode.com (www.opscode.com)...
64.30.132.241 184.106.28.83
64.30.132.241 Reusing existing connection to opscode.com:80.
64.30.132.241 HTTP request sent, awaiting response...
64.30.132.241 301 Moved Permanently
64.30.132.241 Location: http://s3.amazonaws.com/opscode-full-stack/install.sh [following]
64.30.132.241 --2012-07-13 22:47:34-- http://s3.amazonaws.com/opscode-full-stack/install.sh
64.30.132.241 Resolving s3.amazonaws.com (s3.amazonaws.com)...
64.30.132.241 72.21.194.31
64.30.132.241 Connecting to s3.amazonaws.com (s3.amazonaws.com)|72.21.194.31|:80...
64.30.132.241 connected.
64.30.132.241 HTTP request sent, awaiting response...
64.30.132.241 200 OK
64.30.132.241 Length:
64.30.132.241 5204 (5.1K)
64.30.132.241 []
64.30.132.241 Saving to: `STDOUT'
64.30.132.241
0% [ ] 0 --.-K/s
64.30.132.241
64.30.132.241 100%[======================================>] 5,204 --.-K/s in 0s
64.30.132.241
64.30.132.241 2012-07-13 22:47:35 (90.8 MB/s) - written to stdout [5204/5204]
64.30.132.241
64.30.132.241 Unable to determine platform version!
64.30.132.241 Please file a bug report at http://tickets.opscode.com
64.30.132.241 Project: Chef
64.30.132.241 Component: Packages
64.30.132.241 Label: Omnibus
64.30.132.241 Version:
64.30.132.241
64.30.132.241 Please detail your operating system type, version and any other relevant details
64.30.132.241 bash: line 80: chef-client: command not found

Use ProxyCommand in .ssh/config like knife bootstrap

As an alternative to direct --ssh-gateway gateway it is sometimes possible to avail of intermediate SSH servers to act as transparent proxies.

Net::SSH:Config reads .ssh/config and knife bootstrap uses this.

For now I need to use sdc-createmachine followed by knife bootstrap which is unfortunate.

Wrong IP still being used to bootstrap node

Per issue 16 comments after closing.

"This doesn't solve the issue. Sometimes the private ips are first, sometimes last. Some code needs to be added either in knife-joyent to figure out which ip is public or else in fog to return the public ip address of the server."

In fact on the machine I just tried to bootstrap, the IPs came in the order [private, public].

If I have time I'll try and submit a PR here.

support for request signing using ssh-agent

smartdc CLI tools (ex: sdc-listmachines) can use SSH agent to get my private key, but knife-joyent is prompting me for the password on each invocation:

Enter PEM pass phrase:

Is this by design or do I need to configure something differently?

Problematic wiki link in README

From README.md:

To bootstrap chef on SmartOS, use the script provided at the Joyent Wiki which sets up chef-client with SMF and installs the basic essentials.

When I visit this page, I get a Confluence login form. I do work for a Joyent customer, but I have no idea whether any of my existing Joyent credentials will give me access here. I see no obvious way to register for access to the wiki directly.

Whatever information is here may be out of date anyway, because on the main page of the wiki, I see that it's about SmartDataCenter 6, not 7.

ArgumentError before bootstrap on server create

I'm using ChefDK 0.4 and knife-joyent 0.4.12.

When I create a ubuntu machine in JPC the server gets created but the bootstrap fails.
My command line looks like this:
knife joyent server create -N nodename -x ubuntu -I '7735fbba-3706-49f0-8020-9e69e11f8ea1' -f 'g3-standard-0.5-smartos' --networks '1e7bb0e1-25a9-43b6-bb19-f79ae9540b39,193d6804-256c-4e89-a4cd-46f045959993' --tags '{"owner":"cf", "env":"prod"}' -d cf-cz-ubuntu --no-host-key-verify

Running knife bootstrap manually works.
The error is as follows:
...
Sleeping for 10 seconds
ERROR: ArgumentError: wrong number of arguments (1 for 0)

on server create "--environment" does not appear to work

If I supply "--environment dev" as argument to knife joyent server create, the created node is left in the "_default" environment. This breaks my deployment because I rely heavily on environments for global configuration.

Distro is not read properly by Knife::Bootstrap

With chef version 11.16.2, I am trying to use -d to pass in a distro, and using a debugger I can see that the config[:distro] option is never set.

knife joyent server create \
    --flavor "Small 1GB" \
    --networks 1fc62c97-c1f0-41c6-9ef7-1f7ebe0ff09a,f7ed95d3-faaf-43ef-9346-15644403b963\
    --image d34c301e-10c3-11e4-9b79-5f67ca448df0 \
    --node-name 'chef-client-test' \
    --server-name 'chef-client-test'\
    -d smartmachine

This is what config returns inside of Knife::Bootstrap:

{:run_list=>[],
 :ssh_user=>"root",
 :chef_node_name=>"chef-client-test",
 :prerelease=>nil,
 :distro=>"chef-full",
 :use_sudo=>false,
 :environment=>nil,
 :no_host_key_verify=>false,
 :identity_file=>nil,
 :ssh_gateway=>nil,
 :first_boot_attributes=>{}}

Setting the option in config while in the debugger and continuing makes knife work as expected, and use my bootstrapped file. I am not familiar enough with knife/chef to figure out where config comes from, so if y'all have any suggestions to track this down, sound off.

knife-joyent should do a successful ssh login before continuing to bootstrapping phase

If ssh keys aren't in place yet on the new VM, can see this issue:

knife joyent server create --node-name test.demo --image d2ba0f30-bbe8-11e2-a9a2-6bc116856d85 --flavor g3-standard-0.25-kvm --networks "34c063a4-8c75-493d-a393-4cd1894618bb,86754ab6-9ac0-47b0-9ed1-23ec11c42eee" --run-list "recipe[openswan]"
Creating machine test.demo
Waiting for Server to be Provisioned
...................................
Bootstrap IP Address 8.12.46.164
No user defined in knife config for provision tagging -- continuing
Created machine:
ID: e07d36c2-ff93-423e-b3be-bfe441d948d6
Name: test.demo
State: running
Type: virtualmachine
Dataset: sdc:jpc:ubuntu-12.04:2.4.2
IPs: 8.12.46.164 10.100.104.142
Waiting for server to fully initialize...
Waiting for SSH to come up on: 8.12.46.164
.SSHD accepting connections on 8.12.46.164: banner is SSH-2.0-OpenSSH_5.9p1 Debian-5ubuntu1

Bootstrapping Chef on 8.12.46.164
Failed to authenticate root - trying password auth
Enter your password:

@sax

sudo arguments error

We are provision ubuntu certified 12.04 in joyent and it seems sudo arguments are not passed correctly.

knife joyent server create --image fe5aa6c0-0f09-4b1f-9bad-83e453bb74f3 --flavor g3-highcpu-4-kvm --distro auto --networks e9b2351c-b0b7-4388-b660-96a7dfe19566 --environment _default --node-name ubuntu-canonical000 --run-list role[base] --ssh-user ubuntu
Creating machine ubuntu-canonical000
Waiting for Server to be Provisioned
........
Bootstrap IP Address xxx.xxx.xxx.xxx
Updated tags for ubuntu-canonical000
Name         Value
provisioner  helal
Created machine:
ID: 2cba2f72-2733-c011-d290-8e84bfa87e1c
Name: ubuntu-canonical000
State: running
Type: virtualmachine
Dataset: sdc:canonical:ubuntu-certified-12.04:20140408
IPs: xxx.xxx.xxx.xxx
Waiting for server to fully initialize...
Waiting for SSH to come up on: xxx.xxx.xxx.xxx
SSHD accepting connections on xxx.xxx.xxx.xxx: banner is SSH-2.0-OpenSSH_5.9p1 Debian-5ubuntu1.3

Connecting to xxx.xxx.xxx.xxx
xxx.xxx.xxx.xxx usage: sudo [-D level] -h | -K | -k | -V
xxx.xxx.xxx.xxx usage: sudo -v [-AknS] [-D level] [-g groupname|#gid] [-p prompt] [-u user
xxx.xxx.xxx.xxx             name|#uid]
xxx.xxx.xxx.xxx usage: sudo -l[l] [-AknS] [-D level] [-g groupname|#gid] [-p prompt] [-U user
xxx.xxx.xxx.xxx             name] [-u user name|#uid] [-g groupname|#gid] [command]
xxx.xxx.xxx.xxx usage: sudo [-AbEHknPS] [-C fd] [-D level] [-g groupname|#gid] [-p prompt] [-u
xxx.xxx.xxx.xxx             user name|#uid] [-g groupname|#gid] [VAR=value] [-i|-s] [<command>]
xxx.xxx.xxx.xxx usage: sudo -e [-AknS] [-C fd] [-D level] [-g groupname|#gid] [-p prompt] [-u
xxx.xxx.xxx.xxx             user name|#uid] file ...

my knife-joyent (0.4.8) any suggestion what the solution is ?

doesn't work on ubuntu 11.10

Hi,
I've installed knife-joyent (sudo gem install knife-joyent), but it doesn't seem to be recorgnized when doing for example : knife joyent --help, when tried knife-ec2 it worked with no problems, I'm using chef 0.10.8

Text alignment problems on "knife joyent server list"

When servers have no tags, the allignment of output from "knife joyent server list" gets all messed up for me. Quick fix was to and an else statement to the conditional on line 47 of joyent_server_list.rb that appended something like "No Tags" when no tags were found.

"ERROR: An internal service failed" when trying to bootstrap with server create

Sometime in the last week, after doing a gem update, this started happening:

$ knife joyent server create --name foobar -f "Small 1GB" -I 60a3b1fa-0674-11e2-abf5-cb82934a8e24 -N foobar -r "role[myrole]" -d joyent-smartmachine
Creating machine foobar
ERROR: An internal service failed

The joyent-smartmachine bootstrap is from https://github.com/joyent/smartmachine_cookbooks and resides at my ~/.chef/bootstrap/joyent-smartmachine.erb.

knife joyent server list shows the machine in a "provisioning" state. A subsequent bootstrap command works. Perhaps the issue is that knife-joyent is not patient enough to wait for the machine to fully provision?

server resize appears successful even if API call fails

When you try to resize a server and the call fails, you get a response

Resized server ...server_id

with exit status 0 even if the API call fails. For instance, when using the node smartdc tools, you can get the following error response:

Server does not have enough allocatable RAM

See whether the chef ~> 11.6 dependency can be loosened

The knife-joyent gem currently has a dependency on Chef like so:

s.add_dependency "chef", "~> 11.6"

I've found that Chef 12.0.3 makes it very easy to bootstrap new nodes with trusted TLS (née SSL) certificates for servers. But the aforementioned dependency, while prudent and correct for its time, prevents Chef 12 from being used.

On my laptop, I've experimentally changed the dependency to this:

s.add_dependency "chef", ">= 11.6", "< 12.1"

…and it hasn't yet caused any issues in combination with Chef 12.0.3.

I can't boldly say "just change this dependency and everything will be fine" because there aren't any tests to speak of in the knife-joyent source to check this. But it feels OK so far.

provisioning network failure can lead to hanging forever

In the rare case that the network fails to come up for a joyent provisioned machine, this plugin will hang forever. Instead, it should have a reasonable timeout. Issue is in lib/chef/knife/joyent_server_create.rb:

    print(".") until tcp_test_ssh(bootstrap_ip_address) {
      sleep @initial_sleep_delay ||= 10
      puts("done")
    }

This did happen to us, and hung our automation for over an hour (see support ticket 119454)

Support for SDC7 networking options

SDC7 supports firewall rule configuration and vlan assignment via the API. Knife-joyent doesn't support this yet, but we'd love to use it in this way.

We're willing to add support ourselves, but don't want to overlap if it's already in progress.

@bixu

knife-joyent may be broken when testing with self-signed certs and SDC

irvin › env | grep JOY
JOYENT_KEYNAME=irvin
JOYENT_USERNAME=yetu
JOYENT_API_URL=https://10.63.8.26

irvin › knife joyent key list -VV
/Users/irvin/.chefdk/gem/ruby/2.1.0/gems/knife-joyent-0.4.10/lib/chef/knife/joyent_base.rb:86:in `output_error': undefined method `response' for #<Excon::Errors::SocketError:0x007fcf4ac257b0> (NoMethodError)
    from /Users/irvin/.chefdk/gem/ruby/2.1.0/gems/knife-joyent-0.4.10/lib/chef/knife/joyent_key_list.rb:24:in `rescue in run'
    from /Users/irvin/.chefdk/gem/ruby/2.1.0/gems/knife-joyent-0.4.10/lib/chef/knife/joyent_key_list.rb:12:in `run'
    from /opt/chefdk/embedded/apps/chef/lib/chef/knife.rb:493:in `run_with_pretty_exceptions'
    from /opt/chefdk/embedded/apps/chef/lib/chef/knife.rb:174:in `run'
    from /opt/chefdk/embedded/apps/chef/lib/chef/application/knife.rb:139:in `run'
    from /opt/chefdk/embedded/apps/chef/bin/knife:25:in `<top (required)>'
    from /opt/chefdk/bin/knife:33:in `load'
    from /opt/chefdk/bin/knife:33:in `<main>'

sporadic errors

Sometimes I get strange errors like:
$ knife joyent flavor list
/Library/Ruby/Gems/1.8/gems/knife-joyent-0.0.7/lib/chef/knife/joyent_snapshot_delete.rb:4: uninitialized constant KnifeJoyent::Base (NameError)
from /Library/Ruby/Gems/1.8/gems/chef-10.12.0/lib/chef/knife/core/subcommand_loader.rb:37:in load' from /Library/Ruby/Gems/1.8/gems/chef-10.12.0/lib/chef/knife/core/subcommand_loader.rb:37:inload_commands'
from /Library/Ruby/Gems/1.8/gems/chef-10.12.0/lib/chef/knife/core/subcommand_loader.rb:37:in each' from /Library/Ruby/Gems/1.8/gems/chef-10.12.0/lib/chef/knife/core/subcommand_loader.rb:37:inload_commands'
from /Library/Ruby/Gems/1.8/gems/chef-10.12.0/lib/chef/knife.rb:114:in load_commands' from /Library/Ruby/Gems/1.8/gems/chef-10.12.0/lib/chef/knife.rb:162:inrun'
from /Library/Ruby/Gems/1.8/gems/chef-10.12.0/lib/chef/application/knife.rb:123:in run' from /Library/Ruby/Gems/1.8/gems/chef-10.12.0/bin/knife:25 from /usr/bin/knife:19:inload'
from /usr/bin/knife:19

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.