making manifest puppet 4 aware

48 lượt xem
Chuyển tới thư đầu tiên chưa đọc

Vince Skahan

chưa đọc,
14:03:53 4 thg 1, 20174/1/17
đến Puppet Users
We're transitioning from PE 3.7.2 to 2016.latest and are dealing with the differences in pathnames in the new version with it putting stuff under 'code' in the tree.   Is there a recommended way to make our manifests puppet-3 vs puppet-4 aware programmatically ?  With the big changes in version strings for the pieces of the software, I haven't found a usable way yet...



Martin Alfke

chưa đọc,
06:49:54 5 thg 1, 20175/1/17
đến puppet...@googlegroups.com

> On 04 Jan 2017, at 20:03, Vince Skahan <vince...@gmail.com> wrote:
>
> We're transitioning from PE 3.7.2 to 2016.latest and are dealing with the differences in pathnames in the new version with it putting stuff under 'code' in the tree. Is there a recommended way to make our manifests puppet-3 vs puppet-4 aware programmatically ? With the big changes in version strings for the pieces of the software, I haven't found a usable way yet…

I assume you want to switch to different code depending on puppet version.
You can use the fact puppetversion in you rmanifests.

if versioncmp(‘3’, $::puppetversion) < 0 {
# puppet 4
} else {
# puppet 3
}

>
>
>
>
> --
> You received this message because you are subscribed to the Google Groups "Puppet Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/2e9a4859-6004-49f8-bf84-23346952d326%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

Vince Skahan

chưa đọc,
12:10:52 5 thg 1, 20175/1/17
đến Puppet Users
On Thursday, January 5, 2017 at 3:49:54 AM UTC-8, Martin Alfke wrote:
You can use the fact puppetversion in you rmanifests.

if versioncmp(‘3’, $::puppetversion) < 0 {
  # puppet 4
} else {
  # puppet 3
}


There is no such fact on a PE 2016.4.2 client or server:

aio_agent_version => 1.7.1
augeas => {
  version => "1.4.0"
}
facterversion => 3.4.1


There is different stuff on a PE 3.7.2 server and client:

augeasversion => 1.2.0
facterversion => 2.2.0
puppetversion => 3.7.2 (Puppet Enterprise 3.7.0)


Only thing I can think of is looking for puppetversion, and if it's there strip off everthing and see if it starts with a '3', but heaven knows what crazy versioning semantics PuppetLabs will throw at us looking forward, so I don't know if that'll be a stable way to do it or not....


Rob Nelson

chưa đọc,
12:30:51 5 thg 1, 20175/1/17
đến puppet...@googlegroups.com
I see that fact populated across the board on my PE nodes

Inline image 1

Running PE 2016.4.2 on the master but in the process of upgrading all the nodes now.

--
You received this message because you are subscribed to the Google Groups "Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/40b50b46-a526-47f8-98e7-134005824ee1%40googlegroups.com.

Martin Alfke

chưa đọc,
12:35:00 5 thg 1, 20175/1/17
đến puppet...@googlegroups.com
Vince: did you run facter or facter -p ?

> On 05 Jan 2017, at 18:30, Rob Nelson <rnel...@gmail.com> wrote:
>
> I see that fact populated across the board on my PE nodes
>
> <image.png>
>
> Running PE 2016.4.2 on the master but in the process of upgrading all the nodes now.
>
>
> Rob Nelson
> rnel...@gmail.com
>
> On Thu, Jan 5, 2017 at 12:10 PM, Vince Skahan <vince...@gmail.com> wrote:
> On Thursday, January 5, 2017 at 3:49:54 AM UTC-8, Martin Alfke wrote:
> You can use the fact puppetversion in you rmanifests.
>
> if versioncmp(‘3’, $::puppetversion) < 0 {
> # puppet 4
> } else {
> # puppet 3
> }
>
>
> There is no such fact on a PE 2016.4.2 client or server:
>
> aio_agent_version => 1.7.1
> augeas => {
> version => "1.4.0"
> }
> facterversion => 3.4.1
>
>
> There is different stuff on a PE 3.7.2 server and client:
>
> augeasversion => 1.2.0
> facterversion => 2.2.0
> puppetversion => 3.7.2 (Puppet Enterprise 3.7.0)
>
>
> Only thing I can think of is looking for puppetversion, and if it's there strip off everthing and see if it starts with a '3', but heaven knows what crazy versioning semantics PuppetLabs will throw at us looking forward, so I don't know if that'll be a stable way to do it or not....
>
>
>
> --
> You received this message because you are subscribed to the Google Groups "Puppet Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users...@googlegroups.com.
> --
> You received this message because you are subscribed to the Google Groups "Puppet Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/CAC76iT921FVkrPboQ9XhSL%2BaDof2oYF94Z%2B4_XVC6HwpKjOqwg%40mail.gmail.com.

Gabriel Schuyler

chưa đọc,
13:37:57 5 thg 1, 20175/1/17
đến Puppet Users
Hey Vince, the $::aio_agent_version fact only exists on Puppet 4.  So, I've used its existence in the past to determine whether to use a Puppet 3 or 4 code block.  Just wrap your Puppet 4 code block in a conditional that checks for the existence of the fact.

HTH,
Gabe

Rob Nelson

chưa đọc,
14:28:33 5 thg 1, 20175/1/17
đến puppet...@googlegroups.com
With puppet4 showing up in vendor repos, is it safe to assume those versions will not have an aio_agent_version fact?

--
You received this message because you are subscribed to the Google Groups "Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/a18ed67e-9fb7-4f45-a768-5e70470a2c41%40googlegroups.com.

Vince Skahan

chưa đọc,
13:47:51 9 thg 1, 20179/1/17
đến Puppet Users
On Thursday, January 5, 2017 at 11:28:33 AM UTC-8, Rob Nelson wrote:
With puppet4 showing up in vendor repos, is it safe to assume those versions will not have an aio_agent_version fact?
On Thu, Jan 5, 2017 at 1:37 PM, Gabriel Schuyler <ga...@puppet.com> wrote:
Hey Vince, the $::aio_agent_version fact only exists on Puppet 4.  So, I've used its existence in the past to determine whether to use a Puppet 3 or 4 code block.  Just wrap your Puppet 4 code block in a conditional that checks for the existence of the fact.



This kind of uncertainty and hoops to jump through for simple stuff just makes me crazy.

Time to open a ticket with PL to ask for the official answer from them.  Stay tuned.
 

Vince Skahan

chưa đọc,
12:19:24 10 thg 1, 201710/1/17
đến Puppet Users
On Thursday, January 5, 2017 at 10:37:57 AM UTC-8, Gabriel Schuyler wrote:
Hey Vince, the $::aio_agent_version fact only exists on Puppet 4.  So, I've used its existence in the past to determine whether to use a Puppet 3 or 4 code block.  Just wrap your Puppet 4 code block in a conditional that checks for the existence of the fact.



update - I opened a ticket with PL and got a non-answer answer saying 'the usual way is via facts' and saying to check
  • puppetversion
  • pe_server_version
  • aio_agent_version
  • pe_build
What I was looking for, of course, was the one canonical way with code that works on both.  Guess I wish for too much.

Did a little fiddling and found the facts above are available or not differently in pe3.x and pe2016.x depending on whether you're on client or server, and the pe3.x version string is ugly and multi-word.  Nice.

So I have to agree looking for $::aio_agent_version seems to be the best choice for now.

(thanks Gabe!)

Trả lời tất cả
Trả lời tác giả
Chuyển tiếp
0 tin nhắn mới