Actually I meant that all of my workstations begin with a number.  

Thank you.

On Friday, October 21, 2016 at 3:40:48 PM UTC-5, Warron French wrote:
>
> Hello, sorry that I cannot contribute directly to your solution, but in 
> the body of your email messsage you said all workstations start with a *#*, 
> did you mean w?  The two characters on the keyboard are near each other.
>
> --------------------------
> Warron French
>
>
> On Fri, Oct 21, 2016 at 4:05 PM, <[email protected] <javascript:>> wrote:
>
>> I have two custom facts and I have put each file in the directory for a 
>> single module.  Both facts get loaded onto my clients.
>>
>> The problem I am having is that each fact runs successfully when it is by 
>> itself, but when both run at the same time, the results aren't as expected.
>>
>> To test, I rename one fact as *.rb.bak, and then I get proper results.  
>> Switch to the other fact, again, proper results.  Remove .bak so they both 
>> run, results are wrong.
>>
>> Here are my .rb files.
>>
>> All of my servers start with the letter a and have either an aX or aXXX 
>> which describes their physical location.  All of the servers end with 5 
>> characters that describe the network they are on.  The remaining characters 
>> describe what the server does.
>>
>> All of my workstations start with a #.
>>
>> What seems to happen, is that when both facts are running, none of my 
>> servers start with "a" so all of my servers show up as workstations.
>>
>> It appears that 'location_code.slice! seems to run, so the prefix of my 
>> hostname is gone and the first letter appears to be the part of the 
>> hostname that describes the servers function.
>>
>> To test, I changed "a" in my code to "f" and my file server had the 
>> proper server_role of file.
>>
>> I don't understand why this happens as my variables are different between 
>> the two script
>>
>> I appreciate any assistance.
>>
>> require 'facter'
>>
>> Facter.add(:location_code) do
>>   setcode do
>>     address = Facter.value(:ipaddress).tr('.', '')
>>     address = address.to_i
>>     location_code = Facter.value(:hostname)
>>       if address.between?(104127100, 104127255)
>>         location_code.slice!(0,2)
>>       else
>>         location_code.slice!(0,4)
>>       end
>>   end
>> end
>>
>>
>>
>>
>> require 'facter'
>>
>> Facter.add(:server_role) do
>>   setcode do
>>     ip_address = Facter.value(:ipaddress).tr('.', '')
>>     ip_address = ip_address.to_i
>>     server_role = Facter.value(:hostname)
>>     if server_role[0,1] != "a"
>>       server_role = 'workstation'
>>     else
>>       if ip_address.between?(104127100, 104127255)
>>         server_role.slice!(0,2)
>>     else
>>         server_role.slice!(0,4)
>>     end
>>     server_role = server_role[0..-6]
>>     end
>>   end
>> end
>>
>>
>> -- 
>> 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 [email protected] <javascript:>.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/puppet-users/f0e17cd7-6179-4607-ab87-870bed5c4040%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/puppet-users/f0e17cd7-6179-4607-ab87-870bed5c4040%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/c2b30a49-5c0c-4281-82db-d9e58c15f650%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to