-
Notifications
You must be signed in to change notification settings - Fork 112
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
Add all
and first
values to ptr
parameter of dns::record::a
#138
Conversation
all
and first
values to ptr
parameter to dns::record::a
r…all
and first
values to ptr
parameter of dns::record::a
# data => 'multihomed-server.example.com' , | ||
# } | ||
|
||
define dns_reverse_ptr_record ( |
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.
you have to put this in a dns_reverse_ptr_record file, you can't tuck it in init.pp.
How about manifests/record/reverse_ptr.pp?
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.
So it actually does work like this (I tested it), it gets through lint, and it's used by other puppet labs modules as a way to do a private resource type.
I'll make the change if you want it that way for stylistic reasons. I was just trying to keep it private.
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.
It works only because the init class is parsed first. Otherwise puppet would not be able to find this class because it is "hidden" in the init.pp. It violates the autoloading behavior:
https://docs.puppetlabs.com/puppet/latest/reference/lang_namespaces.html#autoloader-behavior
Can you link to the other pupetlabs modules that do this? I've never seen this before in a major module.
I don't think "private" is a much as a concern to me as being not-surprising. We could bump our version of stdlib and use the private keyword directly:
https://docs.puppetlabs.com/guides/style_guide.html#public-and-private
But yes please. Style-wise this is important to me. Both puppet and humans need to be able to find code in a non-surprising location. How about dns::record::reverse_ptr? (dns/manifests/record/reverse_ptr.pp)
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 went back and checked: my mistake - it's not used by puppetlabs modules. it's used by the module razorsedge-network.
In any case, I will rework to use a defined type in a standard location and namespace :)
I reworked the "private" defined type to be |
# | ||
# === Examples | ||
# | ||
# @example |
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.
What is this @example
syntax? Is that some puppet-strings thing?
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 have no idea - it's part of the standard puppet module template that puppet module generate
produces, so I've gotten in the habit of including it.
I just checked back on this PR. Is there anything I need to address? |
still working on this - will continue after i get home from work |
sigh. reverted all my changes in this PR for now. I should remember not to use my PR branches as the source for my production DNS servers. |
…ecord type This updates the `ptr` parameter of the `dns::record::a` type to allow `first` or `all` values. `first` is the same as `true` (or any other `str2bool` true values) and will act as the traditional `ptr` parameter did. With `all`, a `dns::record::ptr` resource is created for all of the ip addresses in `data`, not just the first. This uses a private defined type `dns_reverse_ptr_record` to actually create the `dns::record::ptr` resources so that we can get iteration in the older puppet parsers. This also creates a set of rspec tests for the `dns::record::a` defined type.
dns::record::a::reverse defined type.
Also add `ttl` parameter to `dns::record::ptr::by_ip` to be passed onto the `dns::record::ptr` type.
Okay, the last commit updated the |
Thanks! I think this is pretty comprehensive. |
@jearls: nice idea with checking for an already defined |
@ITler that is correct. |
Sorry about that. I've never been able to use PuppetDB due to work policies, so I don't tend to think in terms of exported resources. @ITler do you have any recommendations about other ways to accomplish this? I can think of two ways; the first is ugly, and the second is a nearly complete rewrite of the module's functionality.
|
Actually, would a third possibility be to define a virtual |
@jearls my proposal: Let Then defensively check, if reverse zone exists (explicitly defined somewhere else in the catalog). If not, create it - Or maybe better, fail with a convenient message to instruct the admin to explicitly define the zone. (Maybe this is better for compatibility). In my opinion, this should allow to use |
@ITler This PR was originally all about changing Second, creating the reverse zone or failing if it doesn't exist would have implications on its own for exported resources, since that check would happen on the client node, not on the server node. |
This updates the
ptr
parameter of thedns::record::a
type to allowfirst
orall
values.first
is the same astrue
(or any otherstr2bool
true values) and will act as the traditionalptr
parameter did. Withall
, adns::record::ptr
resource is created for all of the ip addresses indata
, not just the first. This uses the defined typedns::record::ptr::by_ip
to actually create thedns::record::ptr
resources so that we can get iteration in the older puppet parsers.This also creates a set of rspec tests for the
dns::record::a
defined type.