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

WIP - Fixing instance creation workflow #336

Merged
merged 4 commits into from
May 20, 2018
Merged

Conversation

Temikus
Copy link
Member

@Temikus Temikus commented May 17, 2018

  • 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 #315

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]})

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.

: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)}

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.

@Temikus
Copy link
Member Author

Temikus commented May 17, 2018

This is a reproposal after I accidentally pushed to master.

I'll be in my shame cube.

@Temikus Temikus changed the title Updated example Fixing instance creation workflow May 17, 2018
@Temikus Temikus changed the title Fixing instance creation workflow WIP - Fixing instance creation workflow May 17, 2018
@@ -350,15 +350,26 @@ def set_scheduling(async = true,
reload
end


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.

@Temikus
Copy link
Member Author

Temikus commented May 18, 2018

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

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]

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)

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

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]

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)

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.

Temikus added 3 commits May 19, 2018 20:20
- 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)

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


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
@Temikus
Copy link
Member Author

Temikus commented May 20, 2018

Integration tests pass \o/ I'm merging this.

@Temikus Temikus merged commit 985cd02 into fog:master May 20, 2018
@Temikus Temikus deleted the fix_workflow_5 branch June 22, 2018 00:06
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