puppet windows importing manifests twice when using puppet apply

105 views
Skip to first unread message

Corey Osman

unread,
Oct 16, 2012, 4:34:18 PM10/16/12
to puppet...@googlegroups.com
I am trying to create a masterless local windows installer and I have run into an issue where puppet is importing my manfiests multiple times creating multiple declaration errors.
 
You may notice the importing occurs twice but with different directory layouts.  One import is via puppet while the other has something to do with the modulepath I declared.
 
 
Any ideas?
 
Corey
Here is what I am doing (somewhat abbreviated):
 
 ruby -S -- puppet apply -v --debug --noop --modulepath="dir/puppetmodules" -e "include myclass"
 
debug: importing 'C:\devops\trunk/puppetmodules/myclass/manifests/init.pp' in environment production
debug: importing 'C:/devops/trunk/puppetmodules/myclass/manifests/init.pp' in environment production
debug: Automatically imported myclass from myclass into production
debug: importing 'C:\devops\trunk/puppetmodules/jdk/manifests/init.pp' in environment production
debug: importing 'C:/devops/trunk/puppetmodules/jdk/manifests/init.pp' in environment production
debug: Automatically imported jdk from jdk into production
Duplicate declaration: Exec[create_java_home] is already declared in file C:\devops\trunk/puppetmodules/jdk/manifests/init.pp at line 18; cannot
 redeclare at C:/devops/trunk/puppetmodules/jdk/manifests/init.pp:18 on node hostname_hidden
 
Here is the myclass (changed name for this email)
class myclass {
 class {"myclass::install": }
 
 # Now try and use maven to run the build
 class {"maven::command":
  build_dir => "c:/${mvn_repo_name}",
  command => "verify -Ptests",
  require => [Exec["checksvnrepo"],Class["myclass::install"]],
 }
 
}
 
class myclass::install{
if $::operatingsystem == "windows" {
  class {"jdk": }
  class {"svn": }
  # since springsource comes with maven lets use the builtin maven package
  if $::install_sts == "true" {
   class {"sts":
    require => Class["jdk"]
   }
   $mvn_dir='C:\Program Files\springsource\apache-maven-3.0.3'
   class {"maven::setup":
    mvn_home => "$mvn_dir"
   }
  }
  else{
   # Install and Setup Maven
   class {"maven": }
  }
   }
}
Here is the jdk class being called since its the first class
 
class jdk{
 
 class {"jdk::setup":
  require => Class["jdk::install"],
  java_home => 'C:/Program Files/Java/jdk1.6.0_30',
  java_bin => '%JAVA_HOME%/bin',
 }
 
}
class jdk::setup($java_home, $java_bin){
 # set the user environment variable for java_home
 exec{"create_java_home":
  command => "setx JAVA_HOME \"${java_home}\" /M ",
  path => 'C:\Windows\System32',
  # The unless should really just check if the variable is set for the specific path
  unless => "where javac",
  
 }
 
 # set the user environment variable for java_bin
 exec{"create_java_bin":
  command => "setx JAVA_BIN \"${java_bin}\" /M ",
  path => 'C:\Windows\System32',
  unless => "where javac",
 }
}
class jdk::install{
 exec{"jdkinstaller":
  command => "${::installer_dir}/jdk-6u30-windows-i586.exe /s ADDLOCAL=\"ToolsFeature,DemosFeature,SourceFeature\" ",
  creates => 'C:\Program Files\Java\jdk1.6.0_30\bin\javac.exe',
  logoutput => 'true',
 }

}

Josh Cooper

unread,
Oct 16, 2012, 5:23:41 PM10/16/12
to puppet...@googlegroups.com
Hi Corey,

On Tue, Oct 16, 2012 at 1:34 PM, Corey Osman <co...@logicminds.biz> wrote:
> I am trying to create a masterless local windows installer and I have run
> into an issue where puppet is importing my manfiests multiple times creating
> multiple declaration errors.
>
> You may notice the importing occurs twice but with different directory
> layouts. One import is via puppet while the other has something to do with
> the modulepath I declared.
>
>
> Any ideas?
>
> Corey
> Here is what I am doing (somewhat abbreviated):
>
> ruby -S -- puppet apply -v --debug --noop --modulepath="dir/puppetmodules"
> -e "include myclass"
>
> debug: importing 'C:\devops\trunk/puppetmodules/myclass/manifests/init.pp'
> in environment production
> debug: importing 'C:/devops/trunk/puppetmodules/myclass/manifests/init.pp'
> in environment production

I'm pretty sure this is https://projects.puppetlabs.com/issues/13055

Try specifying the modulepath as
`--modulepath=C:/devops/trunk/puppetmodules` The issue here is that
the win32-dir gem patches Dir.pwd, causing it to return a path with
backslashes. This confuses the autoloader in 2.7.x. However, this
should not be an issue in 3.0. If so, please let me know.

Josh

--
Josh Cooper
Developer, Puppet Labs
Reply all
Reply to author
Forward
0 new messages