Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Composite primary keys as namevars
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  23 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
David Schmitt  
View profile  
 More options Jun 4 2010, 6:45 am
From: David Schmitt <da...@dasz.at>
Date: Fri, 04 Jun 2010 12:45:24 +0200
Local: Fri, Jun 4 2010 6:45 am
Subject: Composite primary keys as namevars
Hi all,

a recurring problem with the namevars are resources that do not have a
natural unique single-property key. For example, mysql users are defined
by their username and the host(-pattern) they are connection from.

Traditionally, this was solved by ugly hackery in the type. In the
windows session at the puppetcamp, Markus and I developed the idea of
associating a set of patterns/syntaxes with the namevar to automatically
parse such multi-key titles and automatically put them into proper
parameters, which can then be validated, munged and used without needing
to know about the actual syntax elsewhere in the type/provider.

I'll start with an example, of how this could look like:

   Puppet::Type.newtype(:mysql_user) do
     @doc = "Manage a mysql database user."

     ensurable

     newtitle do
       pattern "([^@]+)@([^@]+)", :user, :host
       pattern "([^@]+)", :user
     end

     newparam(:user) do
       desc "The username."
     end

     newparam(:host) do
       desc "The host, the users connects from. This may be a pattern
             using '%' and '_'."
       defaultto "%"
     end

Patterns would be tried in order and match groups assigned to the
specified parameters. Having no pattern match woul

This could be used in the following ways:

   mysql_user {
     "foo": ;
     "foo@%": ;   # both 'foo@%'
     "bar": host => "localhost";
     "bar@localhost": ; # both 'bar@localhost'
   }

   Mysql_user { host => "webserver" }
   mysql_user { [ "frob", "frub" ]: }
   # expands to 'frob@webserver' and 'frub@webserver'

   mysql_user {
     "frob": host => "web1";
     "frob": host => "web2";
     "frob": host => "web3";
   }

The last stanza shows how this can be used to confusing effects. This
could be mitigated by allowing using arrays in parameters. For example
creating four users:

   mysql_user {
     [ "frob", "frub" ]:
       host => [ "web1", "web2" ]
   }

Here are some illegal constructs:

   # Setting a property twice
   mysql_user {
     "foo": user => "bar";
     "foo@%": host => "localhost";
   }

   # redefine resources
   mysql_user {
     "frob": ;
     "frob@%": ;

     "foo": host => "localhost";
     "frob@localhost": ;
   }

   # pattern match fails:
   mysql_user {
     [ "", "@", "foo@", "@localhost", "foo@bar@localhost" ]: ;
   }

For more flexibility when parsing, the list-of-paramnames could be
replaced by blocks:

   pattern "complicated_regexp" do
     # insert disgusting hack here
   end

The block would have to return true or false to accept or reject the title.

By substituting the param names into the patterns, puppet could
automatically create documentation like this:

   Patterns:
     1) user@host:
       user must be [^@]+
       host must be [^@]+
     2) user:
       user must be [^@]+
   user: The username.
   host: The host, the users connects from. This may be a pattern using
         '%' and '_'.

This could be enhanced by specifying additional docstrings with the
patterns.

Of course, this is currently vapour-ware, as it'll need some changes in
the puppet core to handle the new uniqueness, but I hope to accelerate
the development by providing a good spec/discussion of how the
"user-facing" side should look like.

Looking forward to your feedback,

Best Regards, David
--
dasz.at OG              Tel: +43 (0)664 2602670     Web: http://dasz.at
Klosterneuburg                                         UID: ATU64260999

        FB-Nr.: FN 309285 g          FB-Gericht: LG Korneuburg


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Trevor Vaughan  
View profile  
 More options Jun 4 2010, 7:12 am
From: Trevor Vaughan <tvaug...@onyxpoint.com>
Date: Fri, 04 Jun 2010 07:12:46 -0400
Local: Fri, Jun 4 2010 7:12 am
Subject: Re: [Puppet-dev] Composite primary keys as namevars

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Wow...this is only slightly terrifying ;-).

Since you're effectively creating a database serialization, why not
simplify the problem by using the concept of primary keys.

So, currently, namevar is built from <name>, could you not instead build
it from multiple values?

In the following example, I'm using the '@' symbol to indicate that
$name/$namevar should be built from an array of values inside the 'foo'
stanza.

foo { @:
  +bar => 'baz',
  +bar2 => 'baz2',
  notakey => 'value'

}

So, $name would now be "baz_baz2" built from the names prepended with a
'+'. I suppose you would probably want to sort the values alphabetically
so that you achieve consistency in your code. Arrays could be handled
through a concatenation of the values or by spawning additional 'foo'
resources.

Does this do what you want? To me it seems to be able to be applied more
generically across all types (including the current ones).

Trevor

On 06/04/2010 06:45 AM, David Schmitt wrote:

- --
Trevor Vaughan
 Vice President, Onyx Point, Inc.
 email: tvaug...@onyxpoint.com
 phone: 410-541-ONYX (6699)
 pgp: 0x6C701E94

- -- This account not approved for unencrypted sensitive information --
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)

iEYEARECAAYFAkwI364ACgkQyWMIJmxwHpS9eACeMraJMOvRFao9SjbRlGDWfANR
4gkAoMOQf/jj9p9qRQFNlG220kfT1S5x
=rQuK
-----END PGP SIGNATURE-----

  tvaughan.vcf
< 1K Download

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
David Schmitt  
View profile  
 More options Jun 4 2010, 8:08 am
From: David Schmitt <da...@dasz.at>
Date: Fri, 04 Jun 2010 14:08:06 +0200
Local: Fri, Jun 4 2010 8:08 am
Subject: Re: [Puppet-dev] Composite primary keys as namevars
On 6/4/2010 1:12 PM, Trevor Vaughan wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1

> Wow...this is only slightly terrifying ;-).

> Since you're effectively creating a database serialization, why not
> simplify the problem by using the concept of primary keys.

No and exactly. The unparsed title would only exist in the manifest and
would be converted to parameters at parse time.

> So, currently, namevar is built from<name>, could you not instead build
> it from multiple values?

That's what happening. In the example, :user and :host form the combined
primary key/namevar.

> In the following example, I'm using the '@' symbol to indicate that
> $name/$namevar should be built from an array of values inside the 'foo'
> stanza.

> foo { @:
>    +bar =>  'baz',
>    +bar2 =>  'baz2',
>    notakey =>  'value'
> }

> So, $name would now be "baz_baz2" built from the names prepended with a
> '+'. I suppose you would probably want to sort the values alphabetically
> so that you achieve consistency in your code. Arrays could be handled
> through a concatenation of the values or by spawning additional 'foo'
> resources.

Are you referring to resources.title in the storedconfigs database? I
don't see this as a primary problem. Queries should use the constituent
parameters (:user, :host) and the title in the db should not be
user-visible at all.

> Does this do what you want? To me it seems to be able to be applied more
> generically across all types (including the current ones).

It is my intention to have this as a core feature, that also can be used
by current types.

Best Regards, DavidS

--
dasz.at OG              Tel: +43 (0)664 2602670     Web: http://dasz.at
Klosterneuburg                                         UID: ATU64260999

        FB-Nr.: FN 309285 g          FB-Gericht: LG Korneuburg


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Markus Roberts  
View profile  
 More options Jun 4 2010, 10:27 am
From: Markus Roberts <mar...@puppetlabs.com>
Date: Fri, 4 Jun 2010 07:27:40 -0700
Local: Fri, Jun 4 2010 10:27 am
Subject: Re: [Puppet-dev] Composite primary keys as namevars

>  # redefine resources
>  mysql_user {
>   "frob": ;
>   "frob@%": ;

>   "foo": host => "localhost";
>   "frob@localhost": ;
>  }

The last pair isn't really a duplicate though, unless you change foo to frob
or frob to foo.

In the following example, I'm using the '@' symbol to indicate that

> $name/$namevar should be built from an array of values inside the 'foo'
> stanza.

> foo { @:
>  +bar => 'baz',
>  +bar2 => 'baz2',
>  notakey => 'value'
> }

> So, $name would now be "baz_baz2" built from the names prepended with a
> '+'. I suppose you would probably want to sort the values alphabetically
> so that you achieve consistency in your code. Arrays could be handled
> through a concatenation of the values or by spawning additional 'foo'
> resources.

The fundamental deference is that David and I are working on a system where,
rather than the namevar being a specific predetermined attribute it would be
be a specific predetermined *set of attributes;* that's the extent of the
change.

What you're describing appears to be having it be an arbitrary, user
determined set of attributes which is way beyond what we're proposing.
Going that far opens a whole case of cans of worms, which we'd rather not.

-- Markus
-----------------------------------------------------------
The power of accurate observation is
commonly called cynicism by those
who have not got it.  ~George Bernard Shaw
------------------------------------------------------------


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
David Schmitt  
View profile  
 More options Jun 4 2010, 11:30 am
From: David Schmitt <da...@dasz.at>
Date: Fri, 04 Jun 2010 17:30:48 +0200
Local: Fri, Jun 4 2010 11:30 am
Subject: Re: [Puppet-dev] Composite primary keys as namevars
On 6/4/2010 4:27 PM, Markus Roberts wrote:

>  >  # redefine resources
>  >  mysql_user {
>  > "frob": ;
>  > "frob@%": ;

>  > "foo": host => "localhost";
>  > "frob@localhost": ;
>  >  }

> The last pair isn't really a duplicate though, unless you change foo to
> frob or frob to foo.

Exactly. I'm glad if that's the only notable thing on your side :-)

Best Regards, David
--
dasz.at OG              Tel: +43 (0)664 2602670     Web: http://dasz.at
Klosterneuburg                                         UID: ATU64260999

        FB-Nr.: FN 309285 g          FB-Gericht: LG Korneuburg


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Luke Kanies  
View profile  
 More options Jun 5 2010, 5:54 pm
From: Luke Kanies <l...@puppetlabs.com>
Date: Sat, 5 Jun 2010 14:54:42 -0700
Local: Sat, Jun 5 2010 5:54 pm
Subject: Re: [Puppet-dev] Composite primary keys as namevars
On Jun 4, 2010, at 3:45 AM, David Schmitt wrote:

> Hi all,

> a recurring problem with the namevars are resources that do not have  
> a natural unique single-property key. For example, mysql users are  
> defined by their username and the host(-pattern) they are connection  
> from.

> Traditionally, this was solved by ugly hackery in the type. In the  
> windows session at the puppetcamp, Markus and I developed the idea  
> of associating a set of patterns/syntaxes with the namevar to  
> automatically parse such multi-key titles and automatically put them  
> into proper parameters, which can then be validated, munged and used  
> without needing to know about the actual syntax elsewhere in the  
> type/provider.

It's definitely long-past time to solve this, and I'm glad it's  
finally being worked on.

What's the reason for not just requiring full parameter specification,  
rather than supporting the title short-hand?

It seems to me we kind of have two problems:  How to uniquely specify  
the resource with parameters, and how to specify it with a resource  
reference.  Your solution (the title becomes a template filled in by  
the different parameters) does kind of neatly solve it, but I'm afraid  
it might be too complicated for normal humans to use.

It'd probably be a good idea to run through three or four other  
resource types with this to see how it works.  E.g., ports (/etc/
services), packages (optionally specify a version number or  
architecture, where two packages with the same name but different  
version/arch are considered different packages depending on the  
provider, I think), and probably something else.

--
Trying to determine what is going on in the world by reading
newspapers is like trying to tell the time by watching the second
hand of a clock. --Ben Hecht
---------------------------------------------------------------------
Luke Kanies  -|-   http://puppetlabs.com   -|-   +1(615)594-8199


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Markus Roberts  
View profile  
 More options Jun 5 2010, 7:30 pm
From: Markus Roberts <mar...@puppetlabs.com>
Date: Sat, 5 Jun 2010 16:30:02 -0700
Local: Sat, Jun 5 2010 7:30 pm
Subject: Re: [Puppet-dev] Composite primary keys as namevars

> What's the reason for not just requiring full parameter specification,

rather than supporting the title short-hand?

The motivating case (file paths, MS Windows vs. *nix, vs. minor players)
have the property that not all fields are normally needed for any specific
case.  We considered the possibility of requiring full specification but
some things (e.g. the drive letter on *nix) really are just undef and
anything else gets ugly fast.

It seems to me we kind of have two problems:  How to uniquely specify the

> resource with parameters, and how to specify it with a resource reference.
>  Your solution (the title becomes a template filled in by the different
> parameters) does kind of neatly solve it, but I'm afraid it might be too
> complicated for normal humans to use.

Playing around with it at puppet came we came to the conclusion that, while
it could in principle get too complicated to use, in the actual use cases it
was dead obvious what was intended--in part because the formats we are
wanting to model are themselves extremely well known.

> It'd probably be a good idea to run through three or four other resource
> types with this to see how it works.  E.g., ports (/etc/services), packages
> (optionally specify a version number or architecture, where two packages
> with the same name but different version/arch are considered different
> packages depending on the provider, I think), and probably something else.

We did go through several (ports, mysql users, etc.) though we didn't do the
package/arch case.

-- Markus
-----------------------------------------------------------
The power of accurate observation is
commonly called cynicism by those
who have not got it.  ~George Bernard Shaw
------------------------------------------------------------


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
David Schmitt  
View profile  
 More options Jun 6 2010, 5:07 pm
From: David Schmitt <da...@dasz.at>
Date: Sun, 06 Jun 2010 23:07:54 +0200
Local: Sun, Jun 6 2010 5:07 pm
Subject: Re: [Puppet-dev] Composite primary keys as namevars
Am 06.06.2010 01:30, schrieb Markus Roberts:

>     It seems to me we kind of have two problems:  How to uniquely
>     specify the resource with parameters, and how to specify it with a
>     resource reference.  Your solution (the title becomes a template
>     filled in by the different parameters) does kind of neatly solve it,
>     but I'm afraid it might be too complicated for normal humans to use.

> Playing around with it at puppet came we came to the conclusion that,
> while it could in principle get too complicated to use, in the actual
> use cases it was dead obvious what was intended--in part because the
> formats we are wanting to model are themselves extremely well known.

What I think you were referring to ("title becomes a template") was only
meant for documentation generation. (Ab-)Using this as a way to create a
canonical title, seems to magical to me.

I failed to include a little bit of code to actually make the title
generation explicit. There should be a separate, explicit code-block in
the newtitle that creates the canonical title from the resource:

     newtitle do
       # match incoming parameters
       pattern "([^@]+)@([^@]+)", :user, :host
       pattern "([^@]+)", :user

       # produce canonical title form for referencing
       canonical_form do
         "%s@%s" % [ @resource[:user], @resource[:host] ]
       end
     end

Especially on the file type, which has very different syntaxes for the
same property combinations (eg: "host:/share" for NFS and "\\host\share"
for UNC) whould need more intelligence than simple substitution for
title generation, while for documentation it would still work.

Does this address your concerns?

Best Regards, David

--
dasz.at OG              Tel: +43 (0)664 2602670     Web: http://dasz.at
Klosterneuburg                                         UID: ATU64260999

        FB-Nr.: FN 309285 g          FB-Gericht: LG Korneuburg


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Luke Kanies  
View profile  
 More options Jun 6 2010, 5:48 pm
From: Luke Kanies <l...@puppetlabs.com>
Date: Sun, 6 Jun 2010 14:48:29 -0700
Local: Sun, Jun 6 2010 5:48 pm
Subject: Re: [Puppet-dev] Composite primary keys as namevars
On Jun 6, 2010, at 2:07 PM, David Schmitt wrote:

On a completely side note, apparently one of the code smells in  
Puppet's existing internal DSL around building resource types is the  
use of 'new' in method names. So I recommend going with just 'title'  
or something similar for the method name.

--
Dawkins's Law of Adversarial Debate:
     When two incompatible beliefs are advocated with equal intensity,
     the truth does not lie half way between them.
---------------------------------------------------------------------
Luke Kanies  -|-   http://puppetlabs.com   -|-   +1(615)594-8199


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Markus Roberts  
View profile  
 More options Jun 6 2010, 6:19 pm
From: Markus Roberts <mar...@puppetlabs.com>
Date: Sun, 6 Jun 2010 15:19:26 -0700
Local: Sun, Jun 6 2010 6:19 pm
Subject: Re: [Puppet-dev] Composite primary keys as namevars

David --

If I'm understanding you correctly, this is completely opposite of what was
discussed at puppet camp (which leads me to suspect that I'm not
understanding you correctly).

My understanding is that the situation can be broken down into several
steps:

   - Instead of having a single namevar, we have a non-empty collection of
   them, and two resources are the same if and only if all of them match.  Note
   that the present situation is a special case of this, where the collection
   always has exactly one member.
   - As currently, namevar is determined by the type.
   - Instead just of inferring the single namevar from the title we let
   types decompose the title into values for several (perhaps all) of the
   namevar components; note that the present situation is again a special case
   of this.
   - As a natural extension of the above, we discussed permitting Brice's
   hash notation in the same role.

At no time that I recall were we talking about "title generation", using a
generated title for uniqueness, or this just being a documentation
convention.

-- Markus


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
David Schmitt  
View profile  
 More options Jun 7 2010, 9:13 am
From: David Schmitt <da...@dasz.at>
Date: Mon, 07 Jun 2010 15:13:55 +0200
Local: Mon, Jun 7 2010 9:13 am
Subject: Re: [Puppet-dev] Composite primary keys as namevars
On 6/7/2010 12:19 AM, Markus Roberts wrote:

That's the internal/implementation side of it. Please see below for
explainations about the frills I added for the more "user"/developer
oriented spec in my mail.

> At no time that I recall were we talking about "title generation", using
> a generated title for uniqueness, or this just being a documentation
> convention.

We didn't talk about it. But how would puppet reference the following
resources in a log message?

   mysql_user {
     "frob": host => "web1";
     "frob": host => "web2";
     "frob": host => "web3";
   }

Shouldn't that be called 'Mysql_user["frob@web1"]' and so on? Since the
manifest doesn't provide that "frob@web" string anywhere, the type must
generate it and the implementor should explicitly choose how.

Also the question arose around Trevor's mail how storedconfig's
resources.title is filled. Which, like the log message, is more of a
usability thing than anything else, because the user would expect a
"well-formed" title, that corresponds to the specified parameters,
independently of how they are specified.

The stuff about automatically generating documentation from patterns was
added by me, when drafting the spec. Substituting the parameter names
into the match groups was a seemingly easy way to generate passable
docstrings from the existing information.

Best Regards, David
--
dasz.at OG              Tel: +43 (0)664 2602670     Web: http://dasz.at
Klosterneuburg                                         UID: ATU64260999

        FB-Nr.: FN 309285 g          FB-Gericht: LG Korneuburg


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Markus Roberts  
View profile  
 More options Jun 7 2010, 10:43 am
From: Markus Roberts <mar...@puppetlabs.com>
Date: Mon, 7 Jun 2010 07:43:14 -0700
Local: Mon, Jun 7 2010 10:43 am
Subject: Re: [Puppet-dev] Composite primary keys as namevars

David --

> That's the internal/implementation side of it. Please see below for

explainations about the frills

> I added for the more "user"/developer oriented spec in my mail.

I saw it, I'm just not sold on it (yet).  The internal side, as you call it,
looks pretty clean and high payoff; the additions are (IMHO) lower payoff
and more problematic.  I'm not saying that I couldn't be convinced, but I
(and I'd thought we) had stopped where we did for exactly that reason.

> We didn't talk about it. But how would puppet reference the following

resources in a log message?

By their titles.  And for this reason users shouldn't give resources titles
that they won't be able to subsequently recognize, just as now.

Also the question arose around Trevor's mail how storedconfig's

> resources.title is filled. Which, like the log message, is more of a
> usability thing than anything else, because the user would expect a
> "well-formed" title, that corresponds to the specified parameters,
> independently of how they are specified.

Ditto with storeconfigs; I'd say use the title, as now.  The idea is very
simple when it's unidirectional and very complicated (or perhaps "simple but
full of edge cases") when you try to make it bi-directional.

BTW, I'll be back in the office as of today & will kick this around with
Jesse, who may convince me one way or the other, and I'll be trying to get
the patches I promised you by the end of this coming week out ASAP .

-- Markus
-----------------------------------------------------------
The power of accurate observation is
commonly called cynicism by those
who have not got it.  ~George Bernard Shaw
------------------------------------------------------------


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
David Schmitt  
View profile  
 More options Jun 7 2010, 10:57 am
From: David Schmitt <da...@dasz.at>
Date: Mon, 07 Jun 2010 16:57:51 +0200
Local: Mon, Jun 7 2010 10:57 am
Subject: Re: [Puppet-dev] Composite primary keys as namevars
On 6/7/2010 4:43 PM, Markus Roberts wrote:

I'll leave the final decision to you. Just let me restate that I believe
that having the additional "render" or "to_s" block (what I called
"canonical_form" in <4C0C0E2A.6090...@dasz.at>) for display purposes[1]
wouldn't hurt as much as not being able to use defaults for properties.

[1] Resource references (for example for dependencies) can parse the
specified string, using the patterns on the type.

Best Regards, David
--
dasz.at OG              Tel: +43 (0)664 2602670     Web: http://dasz.at
Klosterneuburg                                         UID: ATU64260999

        FB-Nr.: FN 309285 g          FB-Gericht: LG Korneuburg


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Luke Kanies  
View profile  
 More options Jun 7 2010, 1:50 pm
From: Luke Kanies <l...@puppetlabs.com>
Date: Mon, 7 Jun 2010 10:50:50 -0700
Local: Mon, Jun 7 2010 1:50 pm
Subject: Re: [Puppet-dev] Composite primary keys as namevars
On Jun 7, 2010, at 7:43 AM, Markus Roberts wrote:

This is basically where I'd planned on taking this - either lose the  
requirement that titles be unique (e.g., dependencies are lazy binding  
anyway, so you could just depend on all things that have that title),  
or don't care about unique titles unless there's a relationship  
involved.  I prefer the former.  Titles are for humans anyway, so they  
have complete control over how it works.

> Also the question arose around Trevor's mail how storedconfig's  
> resources.title is filled. Which, like the log message, is more of a  
> usability thing than anything else, because the user would expect a  
> "well-formed" title, that corresponds to the specified parameters,  
> independently of how they are specified.

> Ditto with storeconfigs; I'd say use the title, as now.  The idea is  
> very simple when it's unidirectional and very complicated (or  
> perhaps "simple but full of edge cases") when you try to make it bi-
> directional.

> BTW, I'll be back in the office as of today & will kick this around  
> with Jesse, who may convince me one way or the other, and I'll be  
> trying to get the patches I promised you by the end of this coming  
> week out ASAP .

--
Don't hit at all if it is honorably possible to avoid hitting; but
never hit soft! -- Theodore Roosevelt
---------------------------------------------------------------------
Luke Kanies  -|-   http://puppetlabs.com   -|-   +1(615)594-8199

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Nigel Kersten  
View profile  
 More options Jun 7 2010, 2:52 pm
From: Nigel Kersten <nig...@google.com>
Date: Mon, 7 Jun 2010 11:52:39 -0700
Local: Mon, Jun 7 2010 2:52 pm
Subject: Re: [Puppet-dev] Composite primary keys as namevars

I concur.

I think it's confusing for people to suddenly have their titles matter if
they specify a relationship, and it's better to lose the uniqueness
requirement instead.

--
nigel

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Markus Roberts  
View profile  
 More options Jun 8 2010, 1:18 pm
From: Markus Roberts <mar...@puppetlabs.com>
Date: Tue, 8 Jun 2010 10:18:12 -0700
Local: Tues, Jun 8 2010 1:18 pm
Subject: Re: [Puppet-dev] Composite primary keys as namevars

David --

> I'll leave the final decision to you. Just let me restate that I believe

that having the additional
> "render" or "to_s" block (what I called "canonical_form" in <

4C0C0E2A.6090...@dasz.at>)
> for display purposes[1] wouldn't hurt as much as not being able to use

defaults for properties.

So after hashing it out in various groups the overwhelming consensus is to
do the parsing part now and leave the generation part for later if the need
materializes.

In the course of the discussions I realized that I don't understand your
"not being able to use defaults for properties" comment.  Could you
elaborate?

-- Markus
-----------------------------------------------------------
The power of accurate observation is
commonly called cynicism by those
who have not got it.  ~George Bernard Shaw
------------------------------------------------------------


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Trevor Vaughan  
View profile  
 More options Jun 8 2010, 8:54 pm
From: Trevor Vaughan <tvaug...@onyxpoint.com>
Date: Wed, 9 Jun 2010 00:54:48 +0000
Local: Tues, Jun 8 2010 8:54 pm
Subject: Re: [Puppet-dev] Composite primary keys as namevars
All,

How does this work in the case of multi-party development?

For instance, you now have the Module Forge (woo), but I'm sure you're
going to get two modules with a 'service { "mysql"' or somesuch.

I know that it's easy to say "just be careful", but throwing up the
overworked puny human SA defense, not conflicting on duplicate names
is going to cause a massive amount of headache in my opinion.

How else could this be solved so that people are not bitten by
conflicts? Warnings perhaps?

Thanks,

Trevor

--
Trevor Vaughan
Vice President, Onyx Point, Inc
(410) 541-6699
tvaug...@onyxpoint.com

-- This account not approved for unencrypted proprietary information --


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Markus Roberts  
View profile  
 More options Jun 9 2010, 12:46 am
From: Markus Roberts <mar...@puppetlabs.com>
Date: Tue, 8 Jun 2010 21:46:41 -0700
Local: Wed, Jun 9 2010 12:46 am
Subject: Re: [Puppet-dev] Composite primary keys as namevars
Trevor --

> How does this work in the case of multi-party development?

> For instance, you now have the Module Forge (woo), but I'm sure you're
> going to get two modules with a 'service { "mysql"' or somesuch.

> I know that it's easy to say "just be careful", but throwing up the
> overworked puny human SA defense, not conflicting on duplicate names
> is going to cause a massive amount of headache in my opinion.

> How else could this be solved so that people are not bitten by
> conflicts? Warnings perhaps?

I'm not sure I'm seeing the problem you are worried about.

The feature we're planning on implementing is very targeted at a
specific class of use cases: places where the natural title of a
resource actually contains two or more pieces of data, such as an MS
Win file path "C:/foo" which contains both a traditional path and a
"drive letter."  The idea is to let the user specify these in the
natural way and parse them to get the individual fields which
(collectively) would be the unique identifier for the resource.

Thus you could have "C:/foo" and "D:/foo" and "C:/bar", etc. so long
as there was only one occurrence of each {drive_letter, path}
combination.

I'm not seeing the multi-party development issue here.

-- Markus
-----------------------------------------------------------
The power of accurate observation is
commonly called cynicism by those
who have not got it.  ~George Bernard Shaw
------------------------------------------------------------


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
David Schmitt  
View profile  
 More options Jun 9 2010, 3:27 am
From: David Schmitt <da...@dasz.at>
Date: Wed, 09 Jun 2010 09:27:13 +0200
Local: Wed, Jun 9 2010 3:27 am
Subject: Re: [Puppet-dev] Composite primary keys as namevars
On 6/8/2010 7:18 PM, Markus Roberts wrote:

Sure. I was referring to this snippet in my original spec:

>   Mysql_user { host => "webserver" }
>   mysql_user { [ "frob", "frub" ]: }
>   # expands to 'frob@webserver' and 'frub@webserver'

>   mysql_user {
>     "frob": host => "web1";
>     "frob": host => "web2";
>     "frob": host => "web3";
>   }

> The last stanza shows how this can be used to confusing effects.

Specifically, I am worried that Mysql_user[frob] becomes illegal and/or
confusing. Thinking more about it, I come to the realisation that
Mysql_user[frob@web1] can use the patterns on the type to create a valid
reference to a single resource.

Best Regards, David
--
dasz.at OG              Tel: +43 (0)664 2602670     Web: http://dasz.at
Klosterneuburg                                         UID: ATU64260999

        FB-Nr.: FN 309285 g          FB-Gericht: LG Korneuburg


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Luke Kanies  
View profile  
 More options Jun 9 2010, 9:04 am
From: Luke Kanies <l...@puppetlabs.com>
Date: Wed, 9 Jun 2010 09:04:14 -0400
Local: Wed, Jun 9 2010 9:04 am
Subject: Re: [Puppet-dev] Composite primary keys as namevars
On Jun 8, 2010, at 8:54 PM, Trevor Vaughan wrote:

> All,

> How does this work in the case of multi-party development?

> For instance, you now have the Module Forge (woo), but I'm sure you're
> going to get two modules with a 'service { "mysql"' or somesuch.

> I know that it's easy to say "just be careful", but throwing up the
> overworked puny human SA defense, not conflicting on duplicate names
> is going to cause a massive amount of headache in my opinion.

> How else could this be solved so that people are not bitten by
> conflicts? Warnings perhaps?

I think there's a misunderstanding - we're not removing the concept of  
resource uniqueness, just how it's implemented.

That is, currently the only way Puppet can know if a resource is  
unique is to require that the type and title are a unique combination,  
but this works poorly for some types - e.g., ports (in /etc/services)  
are not uniquely identifiable without knowing the name, port, and  
protocol (mostly through bad design, IMO, but it's too late now).

What David and Markus are talking about is enhancing the concept of  
uniqueness to enable Puppet to uniquely identify resources by a  
combination of multiple attributes.

Thus, you'll still get failures if two modules specify the same  
resource - it's just the mechanism for validating this is being  
enhanced a bit.

--
He attacked everything in life with a mix of extraordinary genius and
naive incompetence, and it was often difficult to tell which was
which. -- Douglas Adams
---------------------------------------------------------------------
Luke Kanies  -|-   http://puppetlabs.com   -|-   +1(615)594-8199


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Luke Kanies  
View profile  
 More options Jun 9 2010, 9:08 am
From: Luke Kanies <l...@puppetlabs.com>
Date: Wed, 9 Jun 2010 09:08:27 -0400
Local: Wed, Jun 9 2010 9:08 am
Subject: Re: [Puppet-dev] Composite primary keys as namevars
On Jun 9, 2010, at 3:27 AM, David Schmitt wrote:

I think in this case we need a clear definition of how this should  
behave, but the specific definition doesn't actually matter that much.

I'd tend toward Mysql_user[frob] in this case essentially translating  
to the three resources; that is, requiring that reference is  
functionally equivalent to requiring all three of the actual user  
instances.

I'd be just as happy for this to fail if it referred to more than one  
resource.  That is, if you wanted to depend on Mysql_user[frob], you'd  
have to change your code to this:

mysql_user {
   frob_web1: name => frob, host => web1;
   frob_web2: name => frob, host => web2;
   ...

}

Then the reference would have to be Mysql_user[frob_web1].

This is obviously the easiest short-term solution and is probably what  
I would go with to start.

--
It is said that power corrupts, but actually it's more true that power
attracts the corruptible. The sane are usually attracted by other things
than power. -- David Brin
---------------------------------------------------------------------
Luke Kanies  -|-   http://puppetlabs.com   -|-   +1(615)594-8199


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Trevor Vaughan  
View profile   Translate to Translated (View Original)
 More options Jun 9 2010, 3:14 pm
From: Trevor Vaughan <tvaug...@onyxpoint.com>
Date: Wed, 9 Jun 2010 19:14:11 +0000
Local: Wed, Jun 9 2010 3:14 pm
Subject: Re: [Puppet-dev] Composite primary keys as namevars
Yes, complete misunderstanding on my part.

Thanks for the clarification, sounds great to me!

Trevor

--
Trevor Vaughan
Vice President, Onyx Point, Inc
(410) 541-6699
tvaug...@onyxpoint.com

-- This account not approved for unencrypted proprietary information --


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
David Schmitt  
View profile  
 More options Jun 10 2010, 3:23 am
From: David Schmitt <da...@dasz.at>
Date: Thu, 10 Jun 2010 09:23:28 +0200
Local: Thurs, Jun 10 2010 3:23 am
Subject: Re: [Puppet-dev] Composite primary keys as namevars
On 6/9/2010 3:08 PM, Luke Kanies wrote:

+1.

Later this can integrate the collection query syntax to reference more
resources like Mysql_user[|user == 'frob'|] or something.

Best Regards, David
--
dasz.at OG              Tel: +43 (0)664 2602670     Web: http://dasz.at
Klosterneuburg                                         UID: ATU64260999

        FB-Nr.: FN 309285 g          FB-Gericht: LG Korneuburg


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »