Ask Your Question
0

dependency cycle : don't understand why

asked 2015-12-15 07:36:03 -0500

freetux gravatar image

updated 2015-12-16 19:55:04 -0500

Hi, i have this error when i tried to link some classes :

Error: Failed to apply catalog: Found 1 dependency cycle:
(Exec[purge rpm cache tuxedo 12.1.3.0.0.30-1] => Pmu_os_package::Install[tuxedo-12.1.3.0.0.30-1] => Pmu_svc_tuxedo::Install[installation tuxedo 12.1.3.0.0.30-1] => Class[Pmu_svc_tuxedo] => Class[Pmu_svc_art_batch] => Pmu_os_package::Install[art-batch-12.1.3.0.0.23-1] => File[/opt/puppet/var/rpm] => File[/opt/puppet/var/rpm/tuxedo-12.1.3.0.0.30-1.aix7.1.ppc.rpm] => Package[tuxedo-12.1.3.0.0.30-1] => Exec[purge rpm cache tuxedo 12.1.3.0.0.30-1])
Try the '--graph' option and opening the resulting '.dot' file in OmniGraffle or GraphViz

this is the manifest file :

class { 'pmu_os_package':
  reference       => 'lpp_AIX_7100-03-04-1441',
  url_to_rpms     => 'http://sic-mut-refv1.adm.parimutuel.local:8081/nexus/service/local/repositories/rpm_repo/content/',
  url_to_archives => 'http://sic-mut-refv1.adm.parimutuel.local:8081/nexus/service/local/repositories/industrialisation/content/',
}->
class { 'pmu_svc_tuxedo':
  ensure  => "present",
  version => "12.1.3.0.0.30-1",
}
class { 'pmu_svc_art_batch':
  ensure  => present,
  version => '12.1.3.0.0.23-1'
}

this is the pmuospackage::install class :

define pmu_os_package::install (
  $version,
  $prefix = undef,
  $cachedir = "${::puppet_var}/wget-cache",
) {

  debug ("Debut pmu_os_package::install")
  debug ("  version [${version}]")
  debug ("  prefix [${prefix}]")
  debug ("  name [${name}]")
  debug ("  cachedir [${cachedir}]")

  # charge les valeurs passM-ies en paramM-htre M-` la fonction/class init.pp
  #
  include pmu_os_package

  $rpmdir = "${::puppet_var}/rpm"

  ensure_resource('file',$cachedir,{ensure=> directory})
  ensure_resource('file',$rpmdir,{ensure=> directory})

  if $prefix {
    $install_options = ["--prefix=${prefix}"]
  }
  else
  {
    $install_options = ["--prefix=${pmu_os_package::path_to_products}"]
  }

  case $::osfamily {

    "AIX":{

      debug("install_options: [${install_options}], url_to_rpms: [${::pmu_os_package::url_to_rpms}] ")
      $url = search_depot($::pmu_os_package::url_to_rpms, $name, $version)

      if ( $url ){
        $provider='rpm'
        $basename=basename($url)
        $source="${rpmdir}/${basename}"
        debug("Source d'installation : ${::rpmdir}/${basename}")
        wget::fetch { "wget ${url}":
          source      => $url,
          destination => $source,
          verbose     => true,
          cache_dir   => $cachedir,
          mode        => '644',
          before      => Package["${name}-${version}"],
        }

      } else {

        $provider='nim'
        $source  =$::pmu_os_reference

        if ( $prefix ) {
          fail ("unsupported install_options prefix [$prefix]")
        }
      }

      package { "${name}-${version}":
        name            => $name,
        ensure          => $version,
        provider        => $provider,
        install_options => $install_options,
        source          => $source,
      }
    }

    default: {
      package {
        "${name}-${version}":
          name            => $name,
          ensure          => $version,
          install_options => $install_options,
      }
    }
  }
  exec {"purge wget cache ${name} ${version}":
    command     => "/usr/bin/find ${cachedir} -name \"*${name}*\" ! -name \"*${name}-${version}*\" -exec rm {} \\;",
    subscribe   => Package["${name}-${version}"],
    refreshonly => true,
  }
  exec {"purge rpm cache ${name} ${version}":
    command     => "/usr/bin/find ${rpmdir} -name \"*${name}*\" ! -name \"*${name}-${version}*\" -exec rm {} \\;",
    subscribe   => Package["${name}-${version}"],
    refreshonly => true,
  }
}

and this is the pmusvctuxedo class

class pmu_svc_tuxedo(

  $ensure   ,
  $version  ,

) inherits pmu_svc_tuxedo::params {

  case $ensure {

    'present': {
      pmu_svc_tuxedo::install {"installation tuxedo ${version}" :
        version => $version,
      }
    }

    'absent': {
      pmu_svc_tuxedo::uninstall{ "desinstallation tuxedo ${version}":
        version => $version,
      }

    }
  }
}
# Install Tuxedo
#
define pmu_svc_tuxedo::install(

  $version,

) {
  #  include pmu_svc_tuxedo

  group { 'tuxedo':
    ensure     => present,
    gid        => 700,
    ia_load_module => "compat",
  }->
  user { 'tuxedo':
    ensure          => present,
    groups          => ['tuxedo'],
    home            => '/home/tuxedo',
    managehome      => true,
    shell           => '/usr/bin/ksh',
    uid             => 700,
  }->
  pmu_os_package::install { "${pmu_svc_tuxedo::params::package_name}-${version}":
    name     => $pmu_svc_tuxedo::params::package_name,
    version  => $version,
  }
}

and the pmusvcart_batch :

class pmu_svc_art_batch (
  $ensure,
  $version,
) inherits pmu_svc_art_batch::params {
  require pmu_svc_tuxedo
  case $ensure {
    "present": {
      pmu_os_package::install {"art-batch-${version}":
        name    => 'artbatch',
        version => $version,
      }
    }
    "absent": {
      pmu_os_package::uninstall {"art-batch-${version}":
        name    => 'artbatch',
        version => $version,
      }
    }
  }
}
edit retag flag offensive close merge delete

Comments

I think you haven't provided us with all the code. Your defined type pmu_os_package::install is including the class pmu_os_package. Can we see the code for that class? Thanks.

Alex Harvey gravatar imageAlex Harvey ( 2015-12-16 18:53:42 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2015-12-17 03:38:41 -0500

freetux gravatar image

updated 2015-12-17 08:09:25 -0500

i found the answer :

ensure_resource('file',$cachedir,{ensure=> directory})
ensure_resource('file',$rpmdir,{ensure=> directory})

cause cross, i move this in the pmuospackage class and this resolve the issue.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2015-12-15 07:36:03 -0500

Seen: 234 times

Last updated: Dec 17 '15