Skip to content

GH-690 Joyent Cloud Provider#739

Closed
thekvn wants to merge 9 commits intofog:masterfrom
thekvn:690-joyent
Closed

GH-690 Joyent Cloud Provider#739
thekvn wants to merge 9 commits intofog:masterfrom
thekvn:690-joyent

Conversation

@thekvn
Copy link
Copy Markdown
Member

@thekvn thekvn commented Feb 10, 2012

This implements GH-690 Joyent CloudAPI provider support

API Documentation: https://us-west-1.api.joyentcloud.com/docs

Methods implemented (everything in the docs except those under Analytics and Datacenters)

add_machine_tags
create_key
create_machine
create_machine_snapshot
delete_all_machine_metadata
delete_all_machine_tags
delete_key
delete_machine
delete_machine_metadata
delete_machine_snapshot
delete_machine_tag
get_dataset
get_key
get_machine
get_machine_metadata
get_machine_snapshot
get_machine_tag
get_package
list_datasets
list_keys
list_machine_snapshots
list_machine_tags
list_machines
list_packages
reboot_machine
resize_machine
start_machine
start_machine_from_snapshot
stop_machine
update_machine_metadata

Models provided (and their corresponding vocabulary in CloudAPI terms):

Flavor # Machine
Image # Dataset
Key # Key
Server # Machine
Snapshot # Snapshot

Squashed from fog/joyent
@twojcik
Copy link
Copy Markdown

twojcik commented Feb 14, 2012

+1
Any chance it will be merged soon?

@geemus
Copy link
Copy Markdown
Member

geemus commented Feb 15, 2012

Awesome, I'm hoping to find time to review/merge sometime this week.

@geemus geemus mentioned this pull request Feb 15, 2012
@geemus
Copy link
Copy Markdown
Member

geemus commented Feb 17, 2012

@kevinykchan Looks great, a few questions though:

  • Why are all the credentials called :cloudapi_foo, seems like :joyent_foo might be clearer?
  • Where can I sign up for an account to test with? I tried to look at the joyent sight but wasn't sure which thing I really wanted.
  • Are you up for joining the core team to help maintain this moving forward?
    Thanks!
    wes

@thekvn
Copy link
Copy Markdown
Member Author

thekvn commented Feb 18, 2012

@geemus

To sign up for a Joyent account: https://my.joyentcloud.com

The credentials are prefixed with cloudapi because this provider is 100% compatible with deployments of our SmartDataCebter product in which cloudapi is a component of. But you are right, prefixing it with joyent would be more consistent. I'll fix it asap.

And sure, I'll join the team to maintain this going forward.

Thanks!

@geemus
Copy link
Copy Markdown
Member

geemus commented Feb 20, 2012

@kevinykchan Thanks for the info. I can see why cloudapi would also make sense, but I think joyent is probably the better prefix consistency-wise, so thanks for cleaning that up. Will work on getting this merged now.

@geemus
Copy link
Copy Markdown
Member

geemus commented Feb 20, 2012

@kevinykchan I did a little cleanup, but I'm having trouble with the tests. Seems that they aren't really setup to work in non-mock mode (and when I started fixing them up to work in real they started breaking in mock). You can see my initial changes here:
https://github.com/fog/fog/tree/joyent
My expectation is that the following two things should run without failures bundle exec shindo tests/joyent and FOG_MOCK=true bundle exec shindo tests/joyent. So if you could run through those and double check and cleanup the errors that would be awesome. Just let me know if anything is unclear or I can help out. Thanks!

This reverts commit 6e93321.

The reason for reverting this is Joyent's CloudAPI allows authenticating using
either a username/password credential pair OR using a username and SSH private key.

In http-signature authentication scheme, no password is used.
@thekvn
Copy link
Copy Markdown
Member Author

thekvn commented Feb 21, 2012

@geemus

I've push the fixes to the issues above to https://github.com/kevinykchan/fog/tree/joyent
I did revert your change to require cloudapi_password because both cloudapi_keyfile and cloudapi_password can be used to authenticate against our API

Test output:

$ bundle exec shindo tests/joyent
Skipping tests for dynect due to lacking credentials (add some to '~/.fog' to run them)
Skipping tests for ecloud due to lacking credentials (add some to '~/.fog' to run them)
Skipping tests for glesys due to lacking credentials (add some to '~/.fog' to run them)
Skipping tests for ninefold due to lacking credentials (add some to '~/.fog' to run them)
Skipping tests for ovirt due to lacking credentials (add some to '~/.fog' to run them)
Skipping tests for stormondemand due to lacking credentials (add some to '~/.fog' to run them)

Fog::Compute[:joyent] | dataset requests (joyent)
  #list_datasets
    + has proper format

Fog::Compute::Joyent | key requests (joyent)
  #list_keys + has proper format
  #get_key + has proper format
  #delete_key
    + returns status code 204
    + when a key no longer exists

Fog::Compute[:joyent] | machine requests (joyent)
  #list_machines
    + returns an Array of machines
    + has proper format
  #get_machine
    + has proper format

Fog::Compute[:joyent] | package requests (joyent)
  #list_packages
    + has proper format
  #get_package
    + has proper format

10 succeeded in 35.821114 seconds


  ======================

$ FOG_MOCK=true bundle exec shindo tests/joyent

Fog::Compute[:joyent] | dataset requests (joyent)
  #list_datasets
    + has proper format

Fog::Compute::Joyent | key requests (joyent)
  #list_keys + has proper format
  #get_key + has proper format
  #delete_key
    + returns status code 204
    + when a key no longer exists

Fog::Compute[:joyent] | machine requests (joyent)
  #list_machines
    + correct number of machines
    + returns an Array of machines
    + has proper format
  #get_machine
    + has proper format

Fog::Compute[:joyent] | package requests (joyent)
  #list_packages
    + has proper format
  #list_packages
    + has correct number of packages
  #get_package
    + has proper format

Please let me know if you run into more issues. I have plans to continue adding more tests in the future.

@geemus
Copy link
Copy Markdown
Member

geemus commented Feb 22, 2012

@kevinykchan thanks for continuing to help out on this. I'm still getting one failure though, from non-mocked get_machines. Here is what I'm seeing:

geemus  ~/geemus/fog[kevinykchan]  ⌘  be shindo tests/joyent/
  Skipping tests for openstack due to lacking credentials (add some to '~/.fog' to run them)
  Skipping tests for ovirt due to lacking credentials (add some to '~/.fog' to run them)
  Skipping tests for vsphere due to lacking credentials (add some to '~/.fog' to run them)

  Fog::Compute[:joyent] | dataset requests (joyent)
    #list_datasets
      + has proper format

  Fog::Compute::Joyent | key requests (joyent)
    #list_keys + has proper format
    #get_key + has proper format
    #delete_key
      + returns status code 204
      + when a key no longer exists

  Fog::Compute[:joyent] | machine requests (joyent)
    #list_machines
      + returns an Array of machines
      + has proper format
    #get_machine
      - has proper format
      undefined method `[]' for nil:NilClass (NoMethodError)
        /Users/geemus/geemus/fog/tests/joyent/requests/compute/machines_tests.rb:60:in `block (3 levels) in <top (required)>'
        tests/helpers/formats_helper.rb:32:in `instance_eval'
        tests/helpers/formats_helper.rb:32:in `block in formats'
        /Users/geemus/.rvm/gems/ruby-1.9.2-p290/gems/shindo-0.3.4/lib/shindo.rb:139:in `instance_eval'
        /Users/geemus/.rvm/gems/ruby-1.9.2-p290/gems/shindo-0.3.4/lib/shindo.rb:139:in `assert'
        /Users/geemus/.rvm/gems/ruby-1.9.2-p290/gems/shindo-0.3.4/lib/shindo.rb:115:in `test'
        tests/helpers/formats_helper.rb:31:in `formats'
        /Users/geemus/geemus/fog/tests/joyent/requests/compute/machines_tests.rb:59:in `block (2 levels) in <top (required)>'
        /Users/geemus/.rvm/gems/ruby-1.9.2-p290/gems/shindo-0.3.4/lib/shindo.rb:79:in `instance_eval'
        /Users/geemus/.rvm/gems/ruby-1.9.2-p290/gems/shindo-0.3.4/lib/shindo.rb:79:in `tests'
        /Users/geemus/geemus/fog/tests/joyent/requests/compute/machines_tests.rb:58:in `block in <top (required)>'
        /Users/geemus/.rvm/gems/ruby-1.9.2-p290/gems/shindo-0.3.4/lib/shindo.rb:79:in `instance_eval'
        /Users/geemus/.rvm/gems/ruby-1.9.2-p290/gems/shindo-0.3.4/lib/shindo.rb:79:in `tests'
        /Users/geemus/.rvm/gems/ruby-1.9.2-p290/gems/shindo-0.3.4/lib/shindo.rb:38:in `initialize'
        /Users/geemus/.rvm/gems/ruby-1.9.2-p290/gems/shindo-0.3.4/lib/shindo.rb:14:in `new'
        /Users/geemus/.rvm/gems/ruby-1.9.2-p290/gems/shindo-0.3.4/lib/shindo.rb:14:in `tests'
        /Users/geemus/geemus/fog/tests/joyent/requests/compute/machines_tests.rb:1:in `<top (required)>'
        /Users/geemus/.rvm/gems/ruby-1.9.2-p290/gems/shindo-0.3.4/lib/shindo/bin.rb:61:in `load'
        /Users/geemus/.rvm/gems/ruby-1.9.2-p290/gems/shindo-0.3.4/lib/shindo/bin.rb:61:in `block (2 levels) in run_in_thread'
        /Users/geemus/.rvm/gems/ruby-1.9.2-p290/gems/shindo-0.3.4/lib/shindo/bin.rb:58:in `each'
        /Users/geemus/.rvm/gems/ruby-1.9.2-p290/gems/shindo-0.3.4/lib/shindo/bin.rb:58:in `block in run_in_thread'
      Action? [c,q,r,?]? c



  Fog::Compute[:joyent] | package requests (joyent)
    #list_packages
      + has proper format
    #get_package
      + has proper format

  1 failed, 9 succeeded in 23.617851 seconds

Any thoughts?

@thekvn
Copy link
Copy Markdown
Member Author

thekvn commented Feb 22, 2012

Ah it looks like its because you don't have any machines, I will adjust the test to check the length of the resultant.

@rgoytacaz
Copy link
Copy Markdown

looking forward to be able to use this :)
Great job guys, +1.

@geemus
Copy link
Copy Markdown
Member

geemus commented Feb 27, 2012

Merged, thanks!

@geemus geemus closed this Feb 27, 2012
@rgoytacaz
Copy link
Copy Markdown

Pro! New era has begun.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants