-
Notifications
You must be signed in to change notification settings - Fork 26
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
Repo include doesn't always occur before install so need to run twice #10
Comments
Hi @serenakeating, could you tell me more about your use case. |
Hi @msimonin, I was just trying to do a simple install of cassandra nothing too fancy. We are using it with Pithos (an S3 interface that runs on top of cassandra so hence the settings I need). Though I got this error initially and consistently, without even having any of these specific settings. To get it to run for us have had to make this change. I have the following in a .pp file class xxx::cassandra ( class {'::cassandra': anchor {'xxx::cassandra::begin': } -> Class['::cassandra'] -> anchor {'xxx::cassandra::end': } |
Thanks @serenakeating for raising the issue. I agree that repo installed has to be contained. I just would like to be sure to reproduce correctly the issue : Here are my files : # /etc/puppet/modules/containment/manifests/init.pp
class containment (
$max_heap_size = '256m',
$heap_newsize = '64m',
$package_name = 'cassandra',
$start_native_transport = 'true',
$rpc_server_type = 'sync',
$version = '2.0.10',
$seeds,
$listen_address,
$rpc_address,
) {
class {'cassandra':
max_heap_size => $max_heap_size,
heap_newsize => $heap_newsize,
package_name => $package_name,
start_native_transport => $start_native_transport,
rpc_server_type => $rpc_server_type,
seeds => $seeds,
listen_address => $listen_address,
rpc_address => $rpc_address,
version => $version,
}
} # dummy test class which will be chained before cassandra
class ntp {
package { 'ntp':
ensure => installed
}
} # site.pp
node 'node1' {
class { 'containment':
seeds => [ '192.168.100.2'],
listen_address => "192.168.100.3",
rpc_address => "192.168.100.3"
}
include 'ntp'
Class['containment'] -> Class['ntp']
} Output :
Here we can see that ntp package is installed before, that's the issue. |
As a follow up of the previous example. It seems that anchoring at the containment class level solve to issue as @serenakeating did. The containment class : class containment{
...
anchor {'xxx::cassandra::begin': } -> Class['::cassandra'] -> anchor {'xxx::cassandra::end': }
} |
When I run this module in puppet I get the following errors the first time I run:
==> pithos.dev: Error: Could not update: Execution of '/usr/bin/apt-get -q -y -o DPkg::Options::=--force-confold --force-yes install cassandra=2.0.10' returned 100: Reading package lists...
==> pithos.dev: Building dependency tree...
==> pithos.dev: Reading state information...
==> pithos.dev: E: Version '2.0.10' for 'cassandra' was not found
==> pithos.dev: Wrapped exception:
==> pithos.dev: Execution of '/usr/bin/apt-get -q -y -o DPkg::Options::=--force-confold --force-yes install cassandra=2.0.10' returned 100: Reading package lists...
==> pithos.dev: Building dependency tree...
==> pithos.dev: Reading state information...
==> pithos.dev: E: Version '2.0.10' for 'cassandra' was not found
==> pithos.dev: Error: /Stage[main]/Cassandra::Install/Package[dsc]/ensure: change from purged to 2.0.10 failed: Could not update: Execution of '/usr/bin/apt-get -q -y -o DPkg::Options::=--force-confold --force-yes install cassandra=2.0.10' returned 100: Reading package lists...
==> pithos.dev: Building dependency tree...
==> pithos.dev: Reading state information...
==> pithos.dev: E: Version '2.0.10' for 'cassandra' was not found
==> pithos.dev: Error: Execution of '/usr/bin/apt-get -q -y -o DPkg::Options::=--force-confold install python-cql' returned 100: Reading package lists...
==> pithos.dev: Building dependency tree...
==> pithos.dev: Reading state information...
==> pithos.dev: E: Unable to locate package python-cql
==> pithos.dev: Error: /Stage[main]/Cassandra::Install/Package[python-cql]/ensure: change from purged to present failed: Execution of '/usr/bin/apt-get -q -y -o DPkg::Options::=--force-confold install python-cql' returned 100: Reading package lists...
==> pithos.dev: Building dependency tree...
==> pithos.dev: Reading state information...
==> pithos.dev: E: Unable to locate package python-cql
It appears to repo include doesn't happen first as expected since the redhat or debian repo classes not having a contains relationship to the repo class.
https://docs.puppetlabs.com/puppet/latest/reference/lang_containment.html
One way to solve this is to use the anchor pattern. Have done this and raised a pull request with one possible solution which you could include. #9
If you are using > puppet 3.4 you can use the 'contain' keyword. for compatibility < puppet 3.4 there is the anchor containment pattern, which I see you have used already as well.
The text was updated successfully, but these errors were encountered: