-
Notifications
You must be signed in to change notification settings - Fork 145
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
WIP - Fixing instance creation workflow #336
Conversation
data[:tags] = ::Google::Apis::ComputeV1::Tags.new(options[:tags]) | ||
if options[:tags].is_a?(Array) | ||
# Process classic tag notation, i.e. ["fog"] | ||
data[:tags] = ::Google::Apis::ComputeV1::Tags.new({:items => options[:tags]}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Layout/SpaceInsideHashLiteralBraces: Space inside { missing.
Style/BracesAroundHashParameters: Redundant curly braces around a hash parameter.
Layout/SpaceInsideHashLiteralBraces: Space inside } missing.
examples/create_instance.rb
Outdated
:username => ENV["USER"], | ||
:tags => ["fog"], | ||
:service_accounts => %w(sql-admin bigquery https://www.googleapis.com/auth/compute) | ||
:service_accounts => {:scopes => %w(sql-admin bigquery https://www.googleapis.com/auth/compute)} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Layout/SpaceInsideHashLiteralBraces: Space inside { missing.
Layout/SpaceInsideHashLiteralBraces: Space inside } missing.
This is a reproposal after I accidentally pushed to master. I'll be in my shame cube. |
@@ -350,15 +350,26 @@ def set_scheduling(async = true, | |||
reload | |||
end | |||
|
|||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Layout/EmptyLines: Extra blank line detected.
This should also fix #329 Only thing left to add is some tests, I don't want to chase this down again as the underlying metadata format errors are very unintuitive. |
server.set_metadata({'foo' => 'bar', 'baz'=>'foo'}, false) | ||
assert_equal [{:key=>"foo", :value=>"bar"}, {:key=>"baz", :value=>"foo"}], server.metadata[:items] | ||
end | ||
end |
There was a problem hiding this comment.
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.
server = @factory.create | ||
server.wait_for { ready? } | ||
server.set_metadata({'foo' => 'bar', 'baz'=>'foo'}, false) | ||
assert_equal [{:key=>"foo", :value=>"bar"}, {:key=>"baz", :value=>"foo"}], server.metadata[:items] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Layout/SpaceInsideHashLiteralBraces: Space inside { missing.
Layout/SpaceAroundOperators: Surrounding space missing for operator =>.
Layout/SpaceInsideHashLiteralBraces: Space inside } missing.
def test_set_metadata | ||
server = @factory.create | ||
server.wait_for { ready? } | ||
server.set_metadata({'foo' => 'bar', 'baz'=>'foo'}, false) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Layout/SpaceInsideHashLiteralBraces: Space inside { missing.
Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
Layout/SpaceAroundOperators: Surrounding space missing for operator =>.
Layout/SpaceInsideHashLiteralBraces: Space inside } missing.
server.set_metadata({'foo' => 'bar', 'baz'=>'foo'}, false) | ||
assert_equal [{:key=>"foo", :value=>"bar"}, {:key=>"baz", :value=>"foo"}], server.metadata[:items] | ||
end | ||
end |
There was a problem hiding this comment.
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.
server = @factory.create | ||
server.wait_for { ready? } | ||
server.set_metadata({'foo' => 'bar', 'baz'=>'foo'}, false) | ||
assert_equal [{:key=>"foo", :value=>"bar"}, {:key=>"baz", :value=>"foo"}], server.metadata[:items] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Layout/SpaceInsideHashLiteralBraces: Space inside { missing.
Layout/SpaceAroundOperators: Surrounding space missing for operator =>.
Layout/SpaceInsideHashLiteralBraces: Space inside } missing.
def test_set_metadata | ||
server = @factory.create | ||
server.wait_for { ready? } | ||
server.set_metadata({'foo' => 'bar', 'baz'=>'foo'}, false) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Layout/SpaceInsideHashLiteralBraces: Space inside { missing.
Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
Layout/SpaceAroundOperators: Surrounding space missing for operator =>.
Layout/SpaceInsideHashLiteralBraces: Space inside } missing.
- Added a quick helper to process tags the old-fashioned way, as {:items => []} is harder to write - Added :zone_name alias in instances to match Disk model - Fixed create_instance example Fixes fog#315
def test_set_metadata | ||
server = @factory.create | ||
server.wait_for { ready? } | ||
server.set_metadata({ 'foo' => 'bar', 'baz' => 'foo' }, false) |
There was a problem hiding this comment.
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.
@@ -349,16 +349,26 @@ def set_scheduling(async = true, | |||
operation.wait_for { ready? } unless async | |||
reload | |||
end | |||
|
|||
|
There was a problem hiding this comment.
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.
- Fixes the set_metadata method and adopts a better format for it. - This should not be a breaking change since the method appears to have never worked since 2.0 :( - Adding a test for it so it gets caught by CI in the future Fixes fog#329
Integration tests pass \o/ I'm merging this. |
as {:items => []} is harder to write
Fixes #315