Re: [Puppet Users] Re: Execution order of classes in a node

2013-05-29 Thread jcbollinger


On Tuesday, May 28, 2013 3:02:20 PM UTC-5, Bikram wrote:
>
> jcbollinger  stJude.org> writes: 
>
> > If you apply only the first two classes to a clean system, does the 
> domain 
> get created?  I bet it does.John 
> > 
>
>
> Yes, if I run the first two classes first and then separately run the 
> wldomain_create class, it creates the domain successfully. When I run all 
> of 
> them together, in that order, that's when it fails. I'm baffled. 
>
>
That's not what I meant.  If you apply ONLY the first two classes, and not 
the third, then does the domain get created?

In any case, the behavior you observe is surely related to the details of 
the modules involved.  As such, I can only guess about causes without 
having the modules to examine.  Nevertheless, my guesses are sometimes 
pretty good, and in this case I suspect you have a containment problem.  
See the docs 
(http://docs.puppetlabs.com/puppet/3/reference/lang_containment.html) for 
an explanation of the issue and a possible solution.


John

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




Re: [Puppet Users] Re: Execution order of classes in a node

2013-05-28 Thread Bikram
jcbollinger  stJude.org> writes:

> If you apply only the first two classes to a clean system, does the domain 
get created?  I bet it does.John
> 


Yes, if I run the first two classes first and then separately run the 
wldomain_create class, it creates the domain successfully. When I run all of 
them together, in that order, that's when it fails. I'm baffled.

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




Re: [Puppet Users] Re: Execution order of classes

2013-05-28 Thread jcbollinger


On Monday, May 27, 2013 8:48:48 AM UTC-5, Markus Shorty Uckelmann wrote:
>
> Am 24.05.2013 16:20, schrieb jcbollinger: 
>
> >>Whenever I run this code on a client, the "directories" class gets 
> >>executed first 
> > 
> > As judged how? 
>
> Running "puppet apply --test" in a Client, destroying the client(it's a 
> Vagrant instance) and doing it again... ;) 
>
> > All of the methods you tried for declaring the needed relationship are 
> > valid and appear correct.  I conclude that you have diagnosed the 
> > problem incorrectly. 
>
> How should I have diagnosed this? Would have the debug switch helped? 
>
> > those classes' implementations.  I suggest you read the documentation on 
> > that area 
> > (http://docs.puppetlabs.com/puppet/3/reference/lang_containment.html) 
> > for information on that problem and and least one possible solution. 
>
> That did the trick. Now my code looks like this: 
>
> class database ( $serverpackage = 'mariadb' ) { 
>   class { 'database::packages': 
> serverpackage => $serverpackage, 
>   } 
>   # setup data dirs(should change my.cnf and restart mysql!) 
>   class { 'database::directories': 
> require => Class['database::packages'], 
>   } 
>
>   anchor {'db_first':} -> Class['database::packages'] -> anchor 
> {'db_last':} 
>
>   [...] 
> } 
>
> After a handful of testruns it seems to work. I had read the 
> documentation you mentioned and didn't make the connection. My mistake. 
>
>
I'm glad you got it working.

In response to your question, when I said you had diagnosed the problem 
incorrectly, I meant you had come to an incorrect conclusion, not 
necessarily that you had done anything inherently wrong.  However, the 
--debug switch is definitely your friend when you are trying to figure out 
Puppet problems.  If you had enabled it on the agent then you might have 
seen resources from the several classes being applied in an intermingled 
fashion (instead of first all belonging to one class, then all belonging to 
another, etc.), which would have been a clearer sign of a containment 
problem.


Best,

John

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




Re: [Puppet Users] Re: Execution order of classes

2013-05-27 Thread Markus "Shorty" Uckelmann
Am 24.05.2013 16:20, schrieb jcbollinger:

>>Whenever I run this code on a client, the "directories" class gets
>>executed first
> 
> As judged how?

Running "puppet apply --test" in a Client, destroying the client(it's a
Vagrant instance) and doing it again... ;)

> All of the methods you tried for declaring the needed relationship are
> valid and appear correct.  I conclude that you have diagnosed the
> problem incorrectly.

How should I have diagnosed this? Would have the debug switch helped?

> those classes' implementations.  I suggest you read the documentation on
> that area
> (http://docs.puppetlabs.com/puppet/3/reference/lang_containment.html)
> for information on that problem and and least one possible solution.

That did the trick. Now my code looks like this:

class database ( $serverpackage = 'mariadb' ) {
  class { 'database::packages':
serverpackage => $serverpackage,
  }
  # setup data dirs(should change my.cnf and restart mysql!)
  class { 'database::directories':
require => Class['database::packages'],
  }

  anchor {'db_first':} -> Class['database::packages'] -> anchor {'db_last':}

  [...]
}

After a handful of testruns it seems to work. I had read the
documentation you mentioned and didn't make the connection. My mistake.

Thanks for your help John.

BTW: I joined the related bug report ;)

Cheers, Shorty


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




[Puppet Users] Re: Execution order of classes

2013-05-24 Thread jcbollinger


On Friday, May 24, 2013 5:12:33 AM UTC-5, Markus Shorty Uckelmann wrote:
>
> Hi all, 
>
> I'm stuck in the hell of class dependencies and hope that someone here 
> can help me. 
>
> Puppet-Version is 2.7.21 
> It's the Debian Squeeze package from the Puppetlabs Repo. 
>
> I want one class to manage everything database related. So I call it in 
> "site.pp" like this: 
>
>   node client1 { 
> class { 'database': } 
>   } 
>
> It's parameterized and uses default values. The class "database" 
> declares(executes) other classes. 
>
> Now to my problem. I have a "sub"-class "database::packages" which must 
> be executed before every other stuff inside the database class. Here is 
> the code: 
>
> 1 class database { 
> 2   class { 'database::packages': } -> 
> 3   # setup data dirs 
> 4   class { 'database::directories': 
> 5 # require => Class['database::packages'], 
> 6   } 
> 7   # Class['database::packages'] -> Class['database::directories'] 
> 8 } 
>
> I tried three different things. None of them worked. First one is the 
> chaining arrow in line 2. The next two tries I left commented out. In 
> line 5 I tried to require the "packages" class inside the "directories" 
> class declaration. And last in line 7 I tried the chaining again. 
>
> Whenever I run this code on a client, the "directories" class gets 
> executed first



As judged how?

 

> and fails, because it needs a specific user which is 
> setup in the "packages" class. 
>
>
 
All of the methods you tried for declaring the needed relationship are 
valid and appear correct.  I conclude that you have diagnosed the problem 
incorrectly.

To be sure, you do have an order-of-application issue, but I don't think 
it's the relative order of these classes themselves that is the problem.  
It is more likely a containment issue within one or more of those classes' 
implementations.  I suggest you read the documentation on that area 
(http://docs.puppetlabs.com/puppet/3/reference/lang_containment.html) for 
information on that problem and and least one possible solution.


John

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




[Puppet Users] Re: Execution order of classes in a node

2013-05-24 Thread jcbollinger


On Thursday, May 23, 2013 1:45:55 PM UTC-5, Bikram Agarwal wrote:
>
> Hi.
>
> I have three modules in my puppet/modules - 
>
>1. jdk_installer
>2. weblogic_installer
>3. wldomain_create
>
> Each of them have one class (same names as modules).
>
> I have a node in site.pp which calls these 3 classes. And these classes 
> need to be executed in a particular order. This is what I have in site.pp - 
>
> node "devdomain.org"{
> $config = hiera('domaincreation')
> class{'jdk_installer':
>  }
> class{'weblogic_installer':
>require => Class["jdk_installer"],
> }
> class{'wldomain_create':
>require => Class["weblogic_installer"],
> }
> }
>
> Execution order that I am trying to implement is first - jdk_installer 
> followed by weblogic_installer and ending at wldomain_create.
>
> When I run the puppet agent --verbose --test from the agent node, in the 
> output it even looks like it is executing in the correct order. But towards 
> the end, when it is running the wldomain_create class, it errors out saying 
> the domain is already created; as if this class was already ran. Here's the 
> last part of the output - 
>
> notice: /Stage[main]/Weblogic_installer/Exec[Delete Existing jar]/returns: 
> executed successfully
> notice: /Stage[main]/Weblogic_installer/File[Copy_weblogic_jar]/ensure: 
> defined content as '{md5}33d45745ff0510381de84427a7536f65'
> notice: /Stage[main]/Weblogic_installer/File[Copy_silent_xml]/ensure: 
> defined content as '{md5}e71e523800541d4cfa6d60a1da0f4e2a'
> notice: /Stage[main]/Weblogic_installer/Exec[install_wls]/returns: 
> Extracting 
> 0%100%
> notice: /Stage[main]/Weblogic_installer/Exec[install_wls]/returns: 
> executed successfully
> notice: /Stage[main]/Wldomain_create/File[Copy domaincreate 
> script]/ensure: defined content as '{md5}9eb3f3645f8fb3be20af4f64116a9861'
> info: /Stage[main]/Wldomain_create/File[Copy domaincreate script]: 
> Scheduling refresh of Exec[Execute domain create script]
> notice: /Stage[main]/Wldomain_create/Exec[Execute domain create 
> script]/returns:
> notice: /Stage[main]/Wldomain_create/Exec[Execute domain create 
> script]/returns: 
> CLASSPATH=/opt/oracle/middleware/patch_wls1036/profiles/default/sys_manifest_classpath/weblogic_patch.jar:/opt/oracle/jdk/lib/tools.jar:/opt/oracle/middleware/wlserver_10.3/server/lib/weblogic_sp.jar:/opt/oracle/middleware/wlserver_10.3/server/lib/weblogic.jar:/opt/oracle/middleware/modules/features/weblogic.server.modules_10.3.6.0.jar:/opt/oracle/middleware/wlserver_10.3/server/lib/webservices.jar:/opt/oracle/middleware/modules/org.apache.ant_1.7.1/lib/ant-all.jar:/opt/oracle/middleware/modules/net.sf.antcontrib_1.1.0.0_1-0b2/lib/ant-contrib.jar::/opt/oracle/middleware/utils/config/10.3/config-launch.jar::/opt/oracle/middleware/wlserver_10.3/common/derby/lib/derbynet.jar:/opt/oracle/middleware/wlserver_10.3/common/derby/lib/derbyclient.jar:/opt/oracle/middleware/wlserver_10.3/common/derby/lib/derbytools.jar::
> notice: /Stage[main]/Wldomain_create/Exec[Execute domain create 
> script]/returns:
> notice: /Stage[main]/Wldomain_create/Exec[Execute domain create 
> script]/returns: Initializing WebLogic Scripting Tool (WLST) ...
> notice: /Stage[main]/Wldomain_create/Exec[Execute domain create 
> script]/returns:
> notice: /Stage[main]/Wldomain_create/Exec[Execute domain create 
> script]/returns: Welcome to WebLogic Server Administration Scripting Shell
> notice: /Stage[main]/Wldomain_create/Exec[Execute domain create 
> script]/returns:
> notice: /Stage[main]/Wldomain_create/Exec[Execute domain create 
> script]/returns: Type help() for help on available commands
> notice: /Stage[main]/Wldomain_create/Exec[Execute domain create 
> script]/returns:
> notice: /Stage[main]/Wldomain_create/Exec[Execute domain create 
> script]/returns: Length of args:  8 ['create_domain.py', 
> '/opt/oracle/user_projects/domains/domaincreation', '8901', '8902', 
> 'managed_test', '8903', '8904', 'weblogic1']
> notice: /Stage[main]/Wldomain_create/Exec[Execute domain create 
> script]/returns: Error: Current path is invalid for creation. cd() to its 
> parent first.
> notice: /Stage[main]/Wldomain_create/Exec[Execute domain create 
> script]/returns: Domain Created Successfully!
> notice: /Stage[main]/Wldomain_create/Exec[Execute domain create 
> script]/returns: executed successfully
> notice: /Stage[main]/Wldomain_create/Exec[Execute domain create 
> script]/returns:
> notice: /Stage[main]/Wldomain_create/Exec[Execute domain create 
> script]/returns: 
> CLASSPATH=/opt/oracle/middleware/patch_wls1036/profiles/default/sys_manifest_classpath/weblogic_patch.jar:/opt/oracle/jdk/lib/tools.jar:/opt/oracle/middleware/wlserver_10.3/server/lib/weblogic_sp.jar:/opt/oracle/middleware/wlserver_10.3/server/lib/weblogic.jar:/opt/oracle/middleware/modules/features/weblogic.server.modules_10.3.6.0.jar:/opt/oracle/middleware/wlserver_1