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

Fixing Fog::Server user/sshkey workflow #366

Merged
merged 4 commits into from
Jun 23, 2018
Merged

Conversation

Temikus
Copy link
Member

@Temikus Temikus commented Jun 22, 2018

For some reason those were abandoned in 1.0, so core examples and bootstrap no longer worked.
E.g. the following no longer provisioned the keys properly:

 server = connection.servers.create(
    :name => "fog-smoke-test-#{Time.now.to_i}",
    :disks => [disk],
    :machine_type => "n1-standard-1",
    :private_key_path => File.expand_path("~/.ssh/id_rsa"),
    :public_key_path => File.expand_path("~/.ssh/id_rsa.pub"),
    :zone => "us-central1-f",
    :username => ENV["USER"],
    :tags => ["fog"],
    :service_accounts => { :scopes => %w(sql-admin bigquery https://www.googleapis.com/auth/compute) }
  )

This patch will make sure :private_key_path and :public_key_path are processed properly again.

Fixing #362

Not even mentioning that save() shouldn't have had arguments in the first place.
But that's going to be fixed by a larger effort in 2.0 #365

For some reason those were abandoned in 1.0, so core examples no longer worked.
E.g. the following no longer provisioned the keys properly:

 server = connection.servers.create(
    :name => "fog-smoke-test-#{Time.now.to_i}",
    :disks => [disk],
    :machine_type => "n1-standard-1",
    :private_key_path => File.expand_path("~/.ssh/id_rsa"),
    :public_key_path => File.expand_path("~/.ssh/id_rsa.pub"),
    :zone => "us-central1-f",
    :username => ENV["USER"],
    :tags => ["fog"],
    :service_accounts => { :scopes => %w(sql-admin bigquery https://www.googleapis.com/auth/compute) }
  )
To make sure Fog::Compute::Google::Server properly processes
ssh keys and responds to Fog::Compute::Server core methods.
"Fog::Compute::Google::Server loads public_key properly")
end
end
end

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Layout/TrailingBlankLines: Final newline missing.


File.stub :read, key do
server = Fog::Compute::Google::Server.new(
:name => "foo",

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Layout/FirstParameterIndentation: Indent the first parameter one step more than the start of the previous line.

# require testing stuff

class UnitTestServer < MiniTest::Test

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Layout/EmptyLinesAroundClassBody: Extra empty line detected at class body beginning.

@@ -0,0 +1,30 @@
require "helpers/test_helper"
# require testing stuff

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Layout/TrailingWhitespace: Trailing whitespace detected.

"Fog::Compute::Google::Server loads public_key properly")
end
end
end

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Layout/TrailingBlankLines: Final newline missing.


File.stub :read, key do
server = Fog::Compute::Google::Server.new(
:name => "foo",

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Layout/FirstParameterIndentation: Indent the first parameter one step more than the start of the previous line.

# require testing stuff

class UnitTestServer < MiniTest::Test

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Layout/EmptyLinesAroundClassBody: Extra empty line detected at class body beginning.

@@ -0,0 +1,30 @@
require "helpers/test_helper"
# require testing stuff

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Layout/TrailingWhitespace: Trailing whitespace detected.

@Temikus
Copy link
Member Author

Temikus commented Jun 23, 2018

Added a unit test so we don't have to go through this again.

@Temikus
Copy link
Member Author

Temikus commented Jun 23, 2018

Now instance manager group tests are failing for no reason :|
I'll take a look and see if something's happening to the API.

@Temikus
Copy link
Member Author

Temikus commented Jun 23, 2018

All tests pass, merging.

@Temikus Temikus merged commit 7cc35b7 into fog:master Jun 23, 2018
@Temikus Temikus deleted the fix_server_save branch June 23, 2018 01:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants