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

Bootstrap autodelete #367

Merged
merged 10 commits into from
Jun 24, 2018
Merged

Bootstrap autodelete #367

merged 10 commits into from
Jun 24, 2018

Conversation

Temikus
Copy link
Member

@Temikus Temikus commented Jun 23, 2018

  • Add tests for Fog::Compute::Google::Server.bootstrap
  • Set disks to autodelete for servers created with Fog::Compute::Google::Server.bootstrap
  • some drive-by fixes to .bootstrap

Fixes #17

# Name is set this way so it will be cleaned up by CollectionFactory
server = @subject.bootstrap({ :name => "#{CollectionFactory::PREFIX}-#{Time.now.to_i}",
:username => user })
boot_disk = server.disks.find { |disk| disk[:boot] }

Choose a reason for hiding this comment

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

Style/CollectionMethods: Prefer detect over find.


File.stub :read, key do
# Name is set this way so it will be cleaned up by CollectionFactory
server = @subject.bootstrap({ :name => "#{CollectionFactory::PREFIX}-#{Time.now.to_i}",

Choose a reason for hiding this comment

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

Style/BracesAroundHashParameters: Redundant curly braces around a hash parameter.

@Temikus Temikus force-pushed the bootstrap_autodelete branch from 77a80ac to 50e6a29 Compare June 23, 2018 05:10
File.stub :read, key do
# Name is set this way so it will be cleaned up by CollectionFactory
server = @subject.bootstrap( :name => "#{CollectionFactory::PREFIX}-#{Time.now.to_i}",
:username => user )

Choose a reason for hiding this comment

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

Layout/AlignHash: Align the elements of a hash literal if they span more than one line.
Layout/SpaceInsideParens: Space inside parentheses detected.


File.stub :read, key do
# Name is set this way so it will be cleaned up by CollectionFactory
server = @subject.bootstrap( :name => "#{CollectionFactory::PREFIX}-#{Time.now.to_i}",

Choose a reason for hiding this comment

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

Layout/SpaceInsideParens: Space inside parentheses detected.

# TODO: Remove the network init when #360 is fixed
network = { :network => "global/networks/default",
:access_configs => [{ :name => 'External NAT',
:type => 'ONE_TO_ONE_NAT' }] }

Choose a reason for hiding this comment

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

Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.

)
# TODO: Remove the network init when #360 is fixed
network = { :network => "global/networks/default",
:access_configs => [{ :name => 'External NAT',

Choose a reason for hiding this comment

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

Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.

.sshable? Was never removed, it’s just part of the parent Fog::Compute::Server class.

Switching to .ready? here since .sshable? requires `net-ssh`
Updated example to match
@Temikus Temikus force-pushed the bootstrap_autodelete branch from 900f72e to f5ce19b Compare June 23, 2018 06:16
Temikus added 3 commits June 24, 2018 10:43
Forgot the code path where the key doesn’t exist, also assertions were the other way around *shame cube*
Seems this codepath wasn’t tested ever so adding a test so that we’re covered.
@Temikus
Copy link
Member Author

Temikus commented Jun 24, 2018

All tests pass \o/

Merging.

@Temikus Temikus merged commit 70d7aa2 into fog:master Jun 24, 2018
@Temikus Temikus deleted the bootstrap_autodelete branch March 20, 2019 02:00
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.

servers::bootstrap should use disk/autoDelete
2 participants