{"action":"created","issue":{"url":"https://api.github.com/repos/msimonin/puppet-cassandra/issues/10","labels_url":"https://api.github.com/repos/msimonin/puppet-cassandra/issues/10/labels{/name}","comments_url":"https://api.github.com/repos/msimonin/puppet-cassandra/issues/10/comments","events_url":"https://api.github.com/repos/msimonin/puppet-cassandra/issues/10/events","html_url":"https://github.com/msimonin/puppet-cassandra/issues/10","id":52707048,"number":10,"title":"Repo include doesn't always occur before install so need to run twice","user":{"login":"serenakeating","id":10275442,"avatar_url":"https://avatars.githubusercontent.com/u/10275442?v=3","gravatar_id":"","url":"https://api.github.com/users/serenakeating","html_url":"https://github.com/serenakeating","followers_url":"https://api.github.com/users/serenakeating/followers","following_url":"https://api.github.com/users/serenakeating/following{/other_user}","gists_url":"https://api.github.com/users/serenakeating/gists{/gist_id}","starred_url":"https://api.github.com/users/serenakeating/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/serenakeating/subscriptions","organizations_url":"https://api.github.com/users/serenakeating/orgs","repos_url":"https://api.github.com/users/serenakeating/repos","events_url":"https://api.github.com/users/serenakeating/events{/privacy}","received_events_url":"https://api.github.com/users/serenakeating/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2014-12-23T01:45:19Z","updated_at":"2015-01-26T22:57:49Z","closed_at":null,"body":"When I run this module in puppet I get the following errors the first time I run:\r\n==> 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...\r\n==> pithos.dev: Building dependency tree...\r\n==> pithos.dev: Reading state information...\r\n==> pithos.dev: E: Version '2.0.10' for 'cassandra' was not found\r\n==> pithos.dev: Wrapped exception:\r\n==> 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...\r\n==> pithos.dev: Building dependency tree...\r\n==> pithos.dev: Reading state information...\r\n==> pithos.dev: E: Version '2.0.10' for 'cassandra' was not found\r\n==> 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...\r\n==> pithos.dev: Building dependency tree...\r\n==> pithos.dev: Reading state information...\r\n==> pithos.dev: E: Version '2.0.10' for 'cassandra' was not found\r\n==> pithos.dev: Error: Execution of '/usr/bin/apt-get -q -y -o DPkg::Options::=--force-confold install python-cql' returned 100: Reading package lists...\r\n==> pithos.dev: Building dependency tree...\r\n==> pithos.dev: Reading state information...\r\n==> pithos.dev: E: Unable to locate package python-cql\r\n==> 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...\r\n==> pithos.dev: Building dependency tree...\r\n==> pithos.dev: Reading state information...\r\n==> pithos.dev: E: Unable to locate package python-cql\r\n\r\nIt 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.\r\n\r\nhttps://docs.puppetlabs.com/puppet/latest/reference/lang_containment.html\r\n\r\nOne 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. https://github.com/msimonin/puppet-cassandra/pull/9\r\n\r\nIf 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."},"comment":{"url":"https://api.github.com/repos/msimonin/puppet-cassandra/issues/comments/71556647","html_url":"https://github.com/msimonin/puppet-cassandra/issues/10#issuecomment-71556647","issue_url":"https://api.github.com/repos/msimonin/puppet-cassandra/issues/10","id":71556647,"user":{"login":"msimonin","id":2486813,"avatar_url":"https://avatars.githubusercontent.com/u/2486813?v=3","gravatar_id":"","url":"https://api.github.com/users/msimonin","html_url":"https://github.com/msimonin","followers_url":"https://api.github.com/users/msimonin/followers","following_url":"https://api.github.com/users/msimonin/following{/other_user}","gists_url":"https://api.github.com/users/msimonin/gists{/gist_id}","starred_url":"https://api.github.com/users/msimonin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/msimonin/subscriptions","organizations_url":"https://api.github.com/users/msimonin/orgs","repos_url":"https://api.github.com/users/msimonin/repos","events_url":"https://api.github.com/users/msimonin/events{/privacy}","received_events_url":"https://api.github.com/users/msimonin/received_events","type":"User","site_admin":false},"created_at":"2015-01-26T22:57:49Z","updated_at":"2015-01-26T22:57:49Z","body":"Thanks @serenakeating for raising the issue. I agree that repo installed has to be contained.\r\nI'll merge your pr #9  if everything is fine with everyone here. \r\n\r\nI just would like to be sure to reproduce correctly the issue : \r\n\r\nHere are my files : \r\n```puppet\r\n# /etc/puppet/modules/containment/manifests/init.pp\r\nclass containment (\r\n  $max_heap_size = '256m',\r\n  $heap_newsize = '64m',\r\n  $package_name = 'cassandra',\r\n  $start_native_transport = 'true',\r\n  $rpc_server_type = 'sync',\r\n  $version = '2.0.10',\r\n  $seeds,\r\n  $listen_address,\r\n  $rpc_address,\r\n) {\r\n\r\n  class {'cassandra':\r\n    max_heap_size          => $max_heap_size,\r\n    heap_newsize           => $heap_newsize,\r\n    package_name           => $package_name,\r\n    start_native_transport => $start_native_transport,\r\n    rpc_server_type        => $rpc_server_type,\r\n    seeds                  => $seeds,\r\n    listen_address         => $listen_address,\r\n    rpc_address            => $rpc_address,\r\n    version                => $version,\r\n  }\r\n}\r\n```\r\n\r\n```puppet\r\n# dummy test class which will be chained before cassandra\r\nclass ntp {\r\n   package { 'ntp':\r\n      ensure => installed\r\n   }\r\n}\r\n```\r\n\r\n```puppet\r\n# site.pp\r\nnode 'node1' {\r\n  class { 'containment':\r\n    seeds          => [ '192.168.100.2'],\r\n    listen_address => \"192.168.100.3\",\r\n    rpc_address => \"192.168.100.3\"\r\n  }\r\n  include 'ntp'\r\n\r\n  Class['containment'] -> Class['ntp']\r\n}\r\n```\r\n\r\nOutput : \r\n```\r\nNotice: Compiled catalog for node1.localdomain in environment production in 0.78 seconds\r\nNotice: /Stage[main]/Ntp/Package[ntp]/ensure: ensure changed 'purged' to 'present'\r\nNotice: /Stage[main]/Cassandra::Repo::Debian/Apt::Pin[hold_cassandra_at_2.0.10]/File[hold_cassandra_at_2.0.10.pref]/ensure: created\r\nNotice: /Stage[main]/Cassandra::Repo::Debian/Apt::Source[datastax]/Apt::Pin[datastax]/File[datastax.pref]/ensure: created\r\nNotice: /Stage[main]/Cassandra::Repo::Debian/Apt::Source[datastax]/Apt::Key[Add key: B999A372 from Apt::Source datastax]/Apt_key[Add key: B999A372 from Apt::Source datastax]/ensure: created\r\nNotice: /Stage[main]/Cassandra::Repo::Debian/Apt::Source[datastax]/File[datastax.list]/ensure: created\r\n```\r\n\r\nHere we can see that ntp package is installed before, that's the issue.\r\n"}}