FAQ
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',
}

}

--
You received this message because you are subscribed to the Google Groups "Puppet Users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/CuB0G1TQ9SkJ.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.

Search Discussions

  • Josh Cooper at Oct 16, 2012 at 9:23 pm
    Hi Corey,
    On Tue, Oct 16, 2012 at 1:34 PM, Corey Osman 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

    --
    You received this message because you are subscribed to the Google Groups "Puppet Users" group.
    To post to this group, send email to puppet-users@googlegroups.com.
    To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppuppet-users @
categoriespuppet
postedOct 16, '12 at 8:34p
activeOct 16, '12 at 9:23p
posts2
users2
websitepuppetlabs.com

2 users in discussion

Corey Osman: 1 post Josh Cooper: 1 post

People

Translate

site design / logo © 2021 Grokbase