Giter VIP home page Giter VIP logo

Comments (16)

biemond avatar biemond commented on September 25, 2024

Hi,

interesting ,

can you also try to use the sleep parameter on the nodemanager manifest and see if this works.
$sleep = hiera('wls_nodemanager_sleep' , 20), # default sleep time

I am doing the same with version & port number

define orawls::domain (
$version = hiera('wls_version' , 1111), # 1036|1111|1211|1212|1213

I think hiera always return a string and the puppet code find its ok and ruby /fiddyspence-sleep is more strict

newproperty(:bedtime) do
  desc "how long to sleep for"
  munge do |snore|
    Integer(snore)
  end
  validate do |zzzz|
    fail("sleepy time isn't an integer") unless zzzz =~ /^\d+$/
  end

probably 20 is ok, it is only longer when the server got a hard reboot and the nodemanager also tries to start the admin server again.

and you get an error but it is only showing this error.

from biemond-orawls.

adamjk-dev avatar adamjk-dev commented on September 25, 2024

Yeah, that is what I think is happening somehow. I thought wls_nodemanager_sleep was supposed to be interpreted as an integer, but fiddyspence-sleep doesn't seem to deal with that well.

I did comment out the setting in one of my hiera values, and the puppet run did go through (using the default value of 20 from the nodemanager manifest).

I can try some of my other offerings with 20 seconds, but experience has shown that this will not be long enough for me. I had to set that sleep time to up to 260 seconds on some WebLogic 10 clusters with an admin server, node manager, and 2 managed nodes all on the same VM. Weblogic 10 seems to take a bit longer than 12.

I wasn't sure if we can force that variable to be an integer after reading it from hiera or something. Or, since the sleep is a maximum sleep, maybe we can just increase your default value to something a bit larger, since it is a maximum sleep and not a definite sleep (won't hold up execution any longer than it takes the node manager port to come up).

from biemond-orawls.

biemond avatar biemond commented on September 25, 2024

I will increase it

when I read this
https://docs.puppetlabs.com/puppet/latest/reference/lang_datatypes.html#numbers

can you try this in the nodemanager.pp

$bedtime = $sleep * 1

sleep { "wake up ${title}":
bedtime => $bedtime,

from biemond-orawls.

adamjk-dev avatar adamjk-dev commented on September 25, 2024

Ah, nice find, sir. Interesting to know.

I should be able to try, but would it just be easier to multiply the hiera lookup * 1? Then, after you do a hiera lookup or default to 20, we multiple by 1 and get the same as an integer either way?

from biemond-orawls.

adamjk-dev avatar adamjk-dev commented on September 25, 2024

I am not even sure that fixed it, did you try it? I changed that and it is still failing...

from biemond-orawls.

biemond avatar biemond commented on September 25, 2024

indeed , also got an error.

will try something else

from biemond-orawls.

adamjk-dev avatar adamjk-dev commented on September 25, 2024

Glad I am not the only one, haha. Thanks!

from biemond-orawls.

biemond avatar biemond commented on September 25, 2024

Nothing helps,

only can make a custom parser function which returns an integer.

First will try to change puppet-sleep.
fiddyspence/puppet-sleep#1

from biemond-orawls.

adamjk-dev avatar adamjk-dev commented on September 25, 2024

Crazy, that sounds like overkill, I would hope we wouldn't need that. I guess another option is to include library code in your module and control it yourself, but nice to use the provided module.

Also, still have the option to increase the default value since it is just a maximum and shouldn't slow progress for fast node manager startups etc.

from biemond-orawls.

fiddyspence avatar fiddyspence commented on September 25, 2024

Hi - I'm trying to reproduce your behaviour (sorry - been a bit busy), but I can't get it to fail using any of the below, which makes me wonder what values your hiera call is returning that makes the validation fail.

The bottom line is that the sleep type manages to cope with '3' as well as 3 - you don't need to cast, but it does need to be a round Fixnum (not a Float) - I could find the time to make it cope with floats (ruby sleep returns a Fixnum, but it seems like a low value activity)

The validation treats the input like a string, and expects it to match the regex /^\d+$/ (i.e. a whole number)

sleep { 'sdfsd': bedtime => '3', refreshonly => false}
sleep { 3: refreshonly => false}

$foo = hiera('foo','3')
sleep { 'sdfsd': bedtime => $foo, refreshonly => false}

$foo = hiera('foo',3)
sleep { $foo: refreshonly => false}

from biemond-orawls.

biemond avatar biemond commented on September 25, 2024

Hi

I got it failing in all situations ( I know in vagrant I am using ruby 1.8.7 and on the puppet master ruby 1.9.3 )

only executes when I do not set the sleep parameter and then uses the default 20

# manifest
define orawls::nodemanager (
  $sleep  = hiera('wls_nodemanager_sleep' , 20), # default sleep time
) {

  # using fiddyspence/sleep module
  sleep { "wake up ${title}":
    bedtime       => $sleep,
    wakeupfor     => "/bin/ps -ef | grep -v grep | /bin/grep 'weblogic.NodeManager'",
    dozetime      => 2,
    failontimeout => true,
  }

}


$default_params = {}
$nodemanager_instances = hiera('nodemanager_instances', {})
create_resources('orawls::nodemanager',$nodemanager_instances, $default_params)

# hiera
wls_nodemanager_sleep:    25

nodemanager_instances:
  'nodemanager':

or

nodemanager_instances:
  'nodemanager':
    sleep:   25

or directly

orawls::nodemanager{'aaa':
  sleep  => 25
}

from biemond-orawls.

fiddyspence avatar fiddyspence commented on September 25, 2024

Are you somehow getting some whitespace in there (there is currently no legislation for whitespace which would cause what you're seeing)

sleep:   25

e.g.:

kanga:~ fids$ cat foo.pp
$test = hiera('sleep')
define testthing ($sleep = $name) {

  sleep { $name: bedtime => $sleep, refreshonly => false}

}

testthing { 3: }
testthing { '5': }
testthing { 'farce': sleep => 10, }
testthing { 'farcefoo': sleep => '1', }
testthing { $test: }
kanga:~ fids$ cat /var/lib/hiera/common.yaml
---
sleep:    25

kanga:~ fids$ puppet apply foo.pp
Notice: Compiled catalog for kanga.spence.org.uk.local in environment production in 0.07 seconds
Error: Parameter bedtime failed on Sleep[25]: sleepy time isn't an integer at /Users/fids/foo.pp:4
Wrapped exception:
sleepy time isn't an integer

That last error caused by the $test instance of the define, all the others work fine

from biemond-orawls.

biemond avatar biemond commented on September 25, 2024

I also got this error when I don't use hiera
but I think with the current version of hiera everything is string. They gonna change this.

Also tried to cast it to integer inside the define ( $newsleep = 1 * $sleep ) ,this should work when you read the puppet documentation.

from biemond-orawls.

fiddyspence avatar fiddyspence commented on September 25, 2024

It doesn't matter if hiera returns a string, as long as it's /^\d+$/

from biemond-orawls.

adamjk-dev avatar adamjk-dev commented on September 25, 2024

I think we can close this issue now, since it was fixed in the fiddyspence-sleep module in version 1.2.0.

fiddyspence/puppet-sleep#1

from biemond-orawls.

biemond avatar biemond commented on September 25, 2024

Indeed I will at this version as dependency

from biemond-orawls.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.