-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Ansible facts modules #247
Ansible facts modules #247
Conversation
I am a robot that works on MagicModules PRs! I built this PR into one or more PRs on other repositories, and when those are closed, this PR will also be merged and closed. |
fa507a8
to
5ba3207
Compare
This is currently generating the gcp_compute_instance_facts module and uses the gcp_compute_instance integration test for a full end-to-end test of both modules. |
5ba3207
to
9c34e2a
Compare
9c34e2a
to
f52dae5
Compare
Facts modules are in a good place now! I'm successfully building out 1 facts module ( What comes next (but not necessarily in this PR)?
|
Exciting! Are you still looking for a code review for this or do you have more stuff you're hoping to get done in this PR before I take a look? |
Code review would be great!
|
I am a robot that works on MagicModules PRs! Once this PR is approved, you can feel free to merge it without taking any further steps. |
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.
This looks reasonable to me, but I'd like to see it get generated- looks like the magician didn't think there was anything to generate.
products/compute/ansible_facts.yaml
Outdated
compile: | ||
tests: !ruby/object:Api::Resource::HashArray | ||
# This would be for custom network responses. Tests work by running some block | ||
# of autogenerated Chef/Puppet code and then verifying the network calls. |
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.
This comment can probably be changed, since this file is clearly for ansible only
provider/ansible/example.rb
Outdated
# Holds all information necessary to run a facts module and verify the | ||
# creation / deletion of a resource. | ||
# | ||
# command - The gcloud command being run |
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.
I'm not sure this documentation lines up with this class
products/compute/ansible_facts.yaml
Outdated
author: Google Inc. (@googlecloudplatform) | ||
overrides: !ruby/object:Provider::ResourceOverrides | ||
Instance: !ruby/object:Provider::Ansible::ResourceOverride | ||
generate_facts: true |
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.
Hmm, every resource that's listed in this file is going to have generate_facts: true, right? Is there a way we can avoid having to explicitly say that?
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.
I just wanted to do that temporarily. My intention is to set that to true by default (and probably merge this provider into the regular Ansible provider).
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.
This seems very much like enabled: true
, right?
Google::StringUtils.underscore(object.name), | ||
'facts'].join('_') | ||
[ | ||
"- name: verify that #{obj_name} was #{verb}", |
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.
There are a lot of formatting things in here- would it make sense for this part to be an erb template? Or is there enough regular ruby going on that this is better?
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.
For the moment, I think it's alright to keep this as Ruby. I'm going to do a small refactor of this code in a separate PR. It should clean it up and make generating facts examples from regular examples possible.
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.
b294953
to
a67efdd
Compare
I am a robot that works on MagicModules PRs! Once this PR is approved, you can feel free to merge it without taking any further steps. |
cdc59fe
to
4dd2c1c
Compare
Ooh, hey, you've got a Magician bug / Concourse bug - you pushed a commit which didn't modify the SHA of the output magic module repo, while the other one was still running. Nice! It means that Concourse never marked any of your commits as having been successfully run. I can fix it! |
Fix is in #342. Take a look when you get a chance! |
4dd2c1c
to
16a26ef
Compare
I am a robot that works on MagicModules PRs! I built this PR into one or more PRs on other repositories, and when those are closed, this PR will also be merged and closed. |
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.
Facts are a lot like terraform datasources, right?
products/compute/ansible_facts.yaml
Outdated
author: Google Inc. (@googlecloudplatform) | ||
overrides: !ruby/object:Provider::ResourceOverrides | ||
Instance: !ruby/object:Provider::Ansible::ResourceOverride | ||
generate_facts: true |
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.
This seems very much like enabled: true
, right?
Facts are exactly like data sources (according to @danawillow)
Backstory: I was going to combine this into the actual Ansible provider,
but I wasn’t sure if it would become obvious that I would need a separate
provider. My plan is to have a separate provider for the moment and if
there’s no real need for egregious custom code (and it doesn’t clutter
Ansible provider too much), I’ll combine this provider back into Ansible
proper
For the moment, I’m using a separate keyword because I can set it to false
by default.
Did that answer your question? Diffs arent the best on mobile email so I’m
making some educated guesses on what you’re asking.
…On Fri, Jul 13, 2018 at 6:00 PM Nathan McKinley ***@***.***> wrote:
***@***.**** approved this pull request.
Facts are a lot like terraform datasources, right?
------------------------------
In products/compute/ansible_facts.yaml
<#247 (comment)>
:
> +
+--- !ruby/object:Provider::Ansible::Facts::Config
+manifest: !ruby/object:Provider::Ansible::Manifest
+ metadata_version: '1.1'
+ status:
+ - preview
+ supported_by: 'community'
+ requirements:
+ - python >= 2.6
+ - requests >= 2.18.4
+ - google-auth >= 1.3.0
+ version_added: '2.7'
+ author: Google Inc. ***@***.***)
+overrides: !ruby/object:Provider::ResourceOverrides
+ Instance: !ruby/object:Provider::Ansible::ResourceOverride
+ generate_facts: true
This seems very much like enabled: true, right?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#247 (review)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABQ65gn14e5BOcIkOVl5PDJhcEQL78IBks5uGUKZgaJpZM4UbhMM>
.
|
Yeah... I see what you're saying, but I'm feeling suspicious of adding a new provider which will merge code into the same downstream repo. If we don't have a good reason right now to split it out, I vote we don't split it out - it'll never be easier to combine than it is today. |
I like that logic. I'll make that change now.
…On Mon, Jul 16, 2018 at 2:42 PM Nathan McKinley ***@***.***> wrote:
Yeah... I see what you're saying, but I'm feeling suspicious of adding a
new provider which will merge code into the same downstream repo. If we
don't have a good reason right now to split it out, I vote we don't split
it out - it'll never be easier to combine than it is today.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#247 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABQ65t0RA78rqo57mov2cMObnwPPwMgEks5uHQjPgaJpZM4UbhMM>
.
|
…ed out with facts modules
a1863bb
to
ba31600
Compare
I am (still) a robot that works on MagicModules PRs! I just wanted to let you know that your changes (as of commit aa22694) have been included in your existing downstream PRs. |
I am (still) a robot that works on MagicModules PRs! I just wanted to let you know that your changes (as of commit a1863bb) have been included in your existing downstream PRs. |
974695f
to
69b5bc3
Compare
I am (still) a robot that works on MagicModules PRs! I just wanted to let you know that your changes (as of commit 8610537) have been included in your existing downstream PRs. |
I am (still) a robot that works on MagicModules PRs! I just wanted to let you know that your changes (as of commit df2393e) have been included in your existing downstream PRs. |
Tracked submodules are build/puppet/compute build/puppet/sql build/puppet/storage build/puppet/container build/puppet/dns build/puppet/pubsub build/puppet/resourcemanager build/chef/compute build/chef/sql build/chef/storage build/chef/container build/chef/dns build/terraform build/ansible.
This may end up being a long-running PR.
This PR is meant to get support for Ansible facts modules started. So far, the gcp_compute_instance_facts module works.
There is missing documentation and I doubt linters will work on this.
Let me know your thoughts on the best way to slowly merge this in.
[all]
[terraform]
[puppet]
[puppet-compute]
[puppet-sql]
[puppet-storage]
[chef]
[chef-compute]
[chef-sql]
[chef-storage]
[ansible]