Hi,

I changed the code now, but still giving me the error.

Help me

Warning: Could not load fact file
/var/opt/lib/pe-puppet/lib/facter/application_type.rb:
application_type.rb:50: syntax error, unexpected keyword_end, expecting $end

require 'rexml/document'
require 'facter'
 Facter.add(:application_type) do
   confine :hostname => 'hostname'
  setcode do
    application_installed = Facter::Core::Execution.exec('hostname -f')
     # Get the 5th char using slice method to identify Oracle
    if (application_installed.slice(4,1) =~ /e|f|x|o|w/)
      # Get the 6th & 7th char using slice method to identify between
Application/Database
      if(application_installed.slice(5,2)=="db")
        puts "Database"
      elsif(application_installed.slice(5,2)=="ap")
        puts "Oracle"
# Get the 5th char using slice method to identify Informatica
    elsif (application_installed.slice(4,1) =~ /a|m|q/)
      # Get the 6th & 7th char using slice method to identify between
Application/Database
     if(application_installed.slice(5,2)=="db")
        puts "Database"
 elsif (application_installed.slice(5,2)=="ap")
   puts "Informatica"
       # Get the 5th char using slice method to identify IBM
    elsif(application_installed.slice(4,1) =~ /r|y|i/)
      # Get the 6th & 7th char using slice method to identify between
Application/Database
      if(application_installed.slice(5,2)=="db")
        puts "Database"
elsif (application_installed.slice(5,2)=="ap")
  puts "IBM"
    elsif(application_installed.slice(4,3)=="sap")
        puts "Subversion"
    elsif(application_installed.slice(4,3)=="ldb")
        puts "Database"
    else
       puts "puppet"
end
end
end
end
end
end
end
end
end
end
end



On Tue, Jul 1, 2014 at 3:00 PM, Supriya Uppalapati <
supriya.uppalap...@gmail.com> wrote:

> Hi,
>
> I wrote a code to identify application type. gving me issue.
>
> Anyone help me
>
> 1 require 'rexml/document'
>       2 require 'facter'
>       3
>       4  Facter.add(:application_type) do
>       5
>       6    confine :hostname => 'hostname'
>       7
>       8   setcode do
>       9     application_installed = Facter::Core::Execution.exec('hostname
> -f')
>      10      # Get the 5th char using slice method to identify Oracle
>      11     if (application_installed.slice(4,1) =~ /e|f|x|o|w/) then
>      12       # Get the 6th & 7th char using slice method to identify
> between Ap        plication/Database
>      13       if(application_installed.slice(5,2)=="db") then
>      14         puts "Database"
>      15  end
>      16       elsif(application_installed.slice(5,2)=="ap") then
>      17         puts "Oracle"
>      18        end
>      19                  # Get the 5th char using slice method to identify
> Infor        matica
>      20     elsif(application_installed.slice(4,1) =~ /a|m|q/) then
>       21 # Get the 6th & 7th char using slice method to identify between
> Ap        plication/Database
>      23       if(application_installed.slice(5,2)=="db") then
>      24         puts "Database"
>      25 end
>      26 end
>      27  elsif(application_installed.slice(5,2)=="ap") then
>      28                 puts "Informatica "
>      29       end
>      30        # Get the 5th char using slice method to identify IBM
>      31     elsif(application_installed.slice(4,1) =~ /r|y|i/) then
>      32       # Get the 6th & 7th char using slice method to identify
> between Ap        plication/Database
>      33
>      34       if(application_installed.slice(5,2)=="db") then
>      35         puts "Database"
>      36 end
>      37 end
>      38 elsif(application_installed.slice(5,2)=="ap") then
>      39   puts "IBM"
>      40       end
>      41
>      42     elsif(application_installed.slice(4,3)=="sap") then
> puts "Subversion"
>      44 end
>      45     elsif(application_installed.slice(4,3)=="ldb") then
>      46         puts "Database"
>      47 end
>      48     else
>      49        puts "puppet"
>      50
>      51 end
>      52 end
>      53 end
>      54 end
>      55 end
>      56 end
>
> I am having an issue:
>
>
>
>
>
>
>
>
>
> *Warning: Could not load fact file
> /var/opt/lib/pe-puppet/lib/facter/application_type.rb:
> application_type.rb:20: syntax error, unexpected keyword_elsif, expecting
> keyword_end    elsif(application_installed.slice(4,1) =~ /a|m|q/)
> then         ^application_type.rb:20: syntax error, unexpected
> keyword_then, expecting keyword_endapplication_type.rb:27: syntax error,
> unexpected keyword_elsif, expecting
> keyword_end elsif(application_installed.slice(5,2)=="ap") then
> ^application_type.rb:27: syntax error, unexpected keyword_then, expecting
> keyword_endapplication_type.rb:31: syntax error, unexpected keyword_elsif,
> expecting $end    elsif(application_installed.slice(4,1) =~ /r|y|i/) then*
>          ^
>
>
>
>
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Puppet Users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/puppet-users/52TSBgYzbDU/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> puppet-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/puppet-users/234fd692-3336-4a4c-ad04-12abccc8de6d%40googlegroups.com
> <https://groups.google.com/d/msgid/puppet-users/234fd692-3336-4a4c-ad04-12abccc8de6d%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 puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/CAEySWyGGimo1jp4uKSzhic5m-NqPqPOE1c2hSoRm0rwxAsr4Pw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to