Using:
puppetserver-1.0.2-1.el7.noarch
puppet-3.7.4-1.el7.noarch

Doing roles and profiles. Have a define setup to add 'includepkgs' items to 
different yum repos (for security reasons).

In my redis profile if I do this:

$epel_packages = ['redis', 'jemalloc']
repo::epel::add { $epel_packages: } ->
package { $epel_packages:
  ensure => installed,
}

The resource chaining works as expected.

If I try to chain an ensure_resource:

repo::epel::add { $epel_packages: } ->
ensure_resource('package', $epel_packages, {
  'ensure'  => 'present',
})

This gives Error 400 on SERVER: Syntax error at '}' at line x

If I get rid of the "->" the 400 goes away, but we need 2 puppet runs 
because the package install attempt happens before the package is added to 
the includepkgs 

What I'm really trying to do is, use the define and then call an external 
module after. Ideally: 

repo::epel::add { $epel_packages: } ->
class { '::redis':
  manage_repo => false,
}

But this requires 2 puppet runs because arioch's puppet-redis module uses 
ensure_resource which seams to ignores chaining and other attempts to 
ensure order in the profile such as:

repo::epel::add { $epel_packages: }
class { '::redis':
  manage_repo => false,
  require => Repo::Epel::Add[$epel_packages],
}

# or

repo::epel::add { $epel_packages: }
class { '::redis':
  manage_repo => false,
}
Repo::Epel::Add[$epel_packages] -> Class['::redis']

# or

repo::epel::add { $epel_packages:
  before => Class['::redis'],
}
class { '::redis':
  manage_repo => false,
}

Which none of the 3 work. Each requires 2 puppet runs, the first full of 
errors.

You could tell me to not use ensure_resources, but I'm not. I'm using 
someone else's module and trying to enforce order at the profile level.

I could modify the redis module, or maybe send him a pull request to get 
rid of the ensure_resource (which word on the street says ensure_resources 
are as bad as using evals); but I'm guessing there is a puppety way to 
handle this that I'm not finding; or maybe it's a bug that ensure_resource 
ignores all (of my) attempts to assign order? 

Any Ideas?

Have a good day.

-Shawn

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/701e7c6e-07e6-4139-90c3-256507e9bc05%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to