Language: Ruby on Rails

Untitled Ruby on Rails (21-Mar @ 05:39)

Syntax Highlighted Code

  1.                                                                                              Ž  h  L  8  $  
  2.   ô  Þ  Î  ´  –  x      ^  D  8  0  &                    s                     ñÍ[J       %   à  à        h  H                                                                 RSDSH,”ÂZ÷Jš°Ï€jš3   wiatwain.pdb            *                   ‹ÿU‹ì¸csmà9Eu
  3. ÿu Pèe  YY]Ã3À]ÃÌÌÌÌÌ‹ÿU‹ìV‹u3Àë…Àu‹…ÉtÿуÆ;u rì^]ÃÌÌÌÌÌh€   ÿD Y£@# £<# …Àu@à  3ÀÃÌÌÌÌÌ‹ÿU‹ìS3ÀVW9E u&9  ~ÿ
  4.   ‹=( P¾8# éå   3ÀéK  ƒ} …>  d‹
  5. [5 more lines...]

Plain Code

                                                                                              Ž  h  L  8  $  
  ô  Þ  Î  ´  –  x      ^  D  8  0  &                    s                     ñÍ[J       %   à  à        h  H                                                                 RSDSH,”ÂZ÷Jš°Ï€jš3   wiatwain.pdb            *                   ‹ÿU‹ì¸csmà9Eu
ÿuPèe  YY]Ã3À]ÃÌÌÌÌÌ‹ÿU‹ìV‹u3Àë…Àu‹…ÉtÿуÆ;urì^]ÃÌÌÌÌÌh€   ÿD Y£@# £<# …Àu@à  3ÀÃÌÌÌÌÌ‹ÿU‹ìS3ÀVW9Eu&9  ~ÿ
  ‹=( P¾8# éå   3ÀéK  ƒ}…>  d‹
   ‹Y‹=( ‰EP¾8# ë;Ãthè  ÿ  j SVÿ×…ÀuçëÇE   ¡4# j_…Àt    jè  ë9h` hX Ç4#    èÿÿÿYY…À…zÿÿÿhT hP èM  Y‰=4# 3ÛY9]uSVÿ, 9H# thH# è³  Y…Àt
ÿuWÿuÿH# ÿ  ëwhè  ÿ  j jVÿ×…Àuê¡4# ƒøt
jèï  YëM‹@# …Ût0‹=<# ƒÇüë‹…ÀtÿЃï;ûsñSÿ@ ƒ%<#  ƒ%@#  Yj VÇ4#     ÿ, 3À@_^[]Â ÌÌÌÌÌj,hð èš  ‹M3ÒB‰Uä3ö‰uü‰
   ;Îu95  u‰uäé  ;Êt    ƒù…   ¡D# ;Æt6‰Uü‰  ÿuQÿuÿЉEäë‹Eì‹‹    ‰MàPQèýÿÿYYËeè3ö‰uä‰uü9u䄱  ÇEü   ÿuÿuÿuèÖýÿÿ‰Eäë‹Eì‹‹    ‰MÜPQèKýÿÿYYËeè3ö‰uä‰uü9uä„o  ‹MÇEü   ÿuQÿuèº  ‰Eäë‹Eì‹‹    ‰MØPQèýÿÿYYËeè3ö‰uä‰uüƒ}…œ   9uä…“   ÇEü   VVÿuèr  ë‹Eì‹‹    ‰MÔPQèÃüÿÿYYËeè3ö‰uüÇEü   VVÿuèýÿÿë‹Eì‹‹    ‰MÐPQè”üÿÿYYËeè3ö‰uü¡D# ;Æt,ÇEü   VVÿuÿÐë‹Eì‹‹    ‰MÌPQè_üÿÿYYËeè3ö‰uü9ut
ƒ}…€   ÇEü   ÿuÿuÿuè¥üÿÿ‰Eäë‹Eì‹‹    ‰MÈPQèüÿÿYYËeè3ö‰uä‰uü¡D# ;Æt>95  t6ÇEü   ÿuÿuÿuÿЉEäë‹Eì‹‹    ‰MÄPQèÓûÿÿYYËeè3ö‰uä‰uüÇEüþÿÿÿè   ‹Eäè  Â Ç   ÿÿÿÿÃÌÌÌÌÌ‹ÿU‹ìƒ}uè½  ]é‰ýÿÿÌÌÌÌÌÿ%H ÌÌÌÌÌÌÌÌ‹ÿU‹ì‹M¸MZ  f9t3À]ËA<Á8PE  uï3Ò¹  f9H”‹Â]ÃÌÌÌÌÌÌÌÌÌÌÌ‹ÿU‹ì‹E‹H<È·ASV·q3ÒWD…öv‹}‹H;ùr    ‹XÙ;ûr
BƒÀ(;Örè3À_^[]ÃÌÌÌÌÌjhp è‡   ƒeü ¾   Vè\ÿÿÿY…Àt=‹E+ÆPVè‹ÿÿÿYY…Àt+‹@$Áè÷ЃàÇEüþÿÿÿë ‹Eì‹ ‹ 3É=  

Untitled Ruby on Rails (9-Mar @ 08:36)

Syntax Highlighted Code

  1. public class foo()
  2. {
  3.  
  4. }

Plain Code

public class foo()
{

}

Untitled Ruby on Rails (3-Mar @ 07:39)

Syntax Highlighted Code

  1. # SQLite version 3.x
  2. #   gem install sqlite3
  3. #
  4. #   Ensure the SQLite 3 gem is defined in your Gemfile
  5. [24 more lines...]

Plain Code

# SQLite version 3.x
#   gem install sqlite3
#
#   Ensure the SQLite 3 gem is defined in your Gemfile
#   gem 'sqlite3'
development:
  adapter: mysql2
  encoding: utf8
  database: rails_sandbox
  pool: 5
  username: root
  password: # Not needed - local secure environment
  socket: /tmp/mysql.sock

# Warning: The database defined as "test" will be erased and
# re-generated from your development database when you run "rake".
# Do not set this db to the same as development or production.
test:
  adapter: sqlite3
  database: db/test.sqlite3
  pool: 5
  timeout: 5000

production:
  adapter: sqlite3
  database: db/production.sqlite3
  pool: 5
  timeout: 5000

Untitled Ruby on Rails (9-Feb @ 18:56)

Syntax Highlighted Code

  1. ß]]6ãžøÓ]À

Plain Code

ß]|ó]6ãžøÓ]À

Untitled Ruby on Rails (17-Nov @ 09:40)

Syntax Highlighted Code

  1. <%= jvm_params['xmx'] %>
  2.  
  3.  <% if has_variable?("$jvm_params['mxm']") then %>
  4.    checktype1=<%= jvm_params['xmx'] %>
  5. [18 more lines...]

Plain Code

 <%= jvm_params['xmx'] %>

 <% if has_variable?("$jvm_params['mxm']") then %>
   checktype1=<%= jvm_params['xmx'] %>
 <% else %>
   checktype1=512
 <% end %>

 checktype2=<%= jvm_params['xmx'] rescue "512" -%>


-Xmx<%= has_variable?("jvm_params['mxm']") ? jvm_params['mxm'] : '64' %>m


<% jvm_params.each do |key,value| -%>
  key: <%= key %> value: <%= value %>
  <% if key == 'maxperm' then -%> -XX:MaxPermSize=<%= value %>m<% end -%>
  <% if key == 'newsize' then -%> -XX:NewSize=<%= value %>m<% end -%>
  <% if key == 'perm' then -%> -XX:PermSize=<%= value %>m<% end -%>
  <% if key == 'xms' then -%> -Xms<%= value %>m<% end -%>
  <% if key == 'xmx' -%>-Xmx<%= value %>m<% end -%>
<% end -%>

Untitled Ruby on Rails (3-Jul @ 21:13)

Syntax Highlighted Code

  1. ## config/database.yml
  2.  
  3. login: &login
  4.   adapter: mysql
  5. [33 more lines...]

Plain Code

## config/database.yml

login: &login
  adapter: mysql
  host: localhost
  username: erictypo
  password: XXX


development:
  database: erictypodev
  <<: *login

test:
  database: erictypotest
  <<: *login

production:
  database: erictypo
  <<: *login

## 
[eric@hexanite.explosive.net ~/typo.live]% rake db:create RAILS_ENV=production                                                                    
 already exists

## but ...
mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema | 
| erictypotest       | 
| gallery2           | 
| mysql              | 
| roundcubemail      | 
| smartj             | 
| test               | 
+--------------------+

Untitled Ruby on Rails (6-Jun @ 06:04)

Syntax Highlighted Code

  1. chgkdikdtk

Plain Code

chgkdikdtk

Untitled Ruby on Rails (9-May @ 13:16)

Syntax Highlighted Code

  1. [pid  8475] stat("/home/paula/.puppet/ssl/certs/ca.pem", {st_mode=S_IFREG|0644, st_size=834, ...}) = 0
  2. [pid  8475] stat("/home/paula/.puppet/ssl/certs/puppetmaster.test.net.pem", {st_mode=S_IFREG|0644, st_size=887, ...}) = 0
  3. Host s3p3147.test.net failed: nested asn1 error
  4.  

Plain Code

[pid  8475] stat("/home/paula/.puppet/ssl/certs/ca.pem", {st_mode=S_IFREG|0644, st_size=834, ...}) = 0
[pid  8475] stat("/home/paula/.puppet/ssl/certs/puppetmaster.test.net.pem", {st_mode=S_IFREG|0644, st_size=887, ...}) = 0
Host s3p3147.test.net failed: nested asn1 error

Untitled Ruby on Rails (9-May @ 12:54)

Syntax Highlighted Code

  1. successful strace puppet kick output as root
  2. [pid  6512] open("/var/lib/puppet/ssl/private_keys/puppetmaster.te <
  3. [pid  6512] open("/var/lib/puppet/ssl/certs/ca.pem", O_RDONLY <
  4. [pid  6512] open("/var/lib/puppet/ssl/certs/s3p2106.enbw.net. <
  5. [17 more lines...]

Plain Code

successful strace puppet kick output as root
[pid  6512] open("/var/lib/puppet/ssl/private_keys/puppetmaster.te <
[pid  6512] open("/var/lib/puppet/ssl/certs/ca.pem", O_RDONLY <
[pid  6512] open("/var/lib/puppet/ssl/certs/s3p2106.enbw.net. <
[pid  6512] open("/var/lib/puppet/ssl/certs/ca.pem", O_RDONLY <
[pid  6512] open("/var/lib/puppet/ssl/crl.pem", O_RDONLY) = 5 <



permissionsof those files:
paula@puppetmaster:/var/lib/puppet/ssl$ ll private_keys/ certs/ crl.pem
-rw-r--r-- 1 puppet web-team  633 2011-04-14 10:47 crl.pem

certs/:
total 8.0K
-rw-r--r-- 1 puppet web-team 834 2010-10-26 11:29 ca.pem
-rw-r--r-- 1 puppet web-team 948 2010-10-26 11:29 puppetmaster.test.net.pem

private_keys/:
total 4.0K
-rw-rw---- 1 puppet web-team 887 2010-10-26 11:29 puppetmaster.test.net.pem

Untitled Ruby on Rails (9-May @ 12:51)

Syntax Highlighted Code

  1. root@puppetmaster:~# la /var/lib/puppet/ssl
  2. total 40K
  3. drwxrwx--x  9 puppet web-team 4.0K 2011-05-09 13:26 ./
  4. d-wxrwx--x 17 puppet web-team 4.0K 2011-05-09 13:47 ../
  5. [8 more lines...]

Plain Code

root@puppetmaster:~# la /var/lib/puppet/ssl
total 40K
drwxrwx--x  9 puppet web-team 4.0K 2011-05-09 13:26 ./
d-wxrwx--x 17 puppet web-team 4.0K 2011-05-09 13:47 ../
drwxrwx---  6 puppet web-team 4.0K 2011-04-27 15:12 ca/
drwxrwxr-x  3 puppet web-team 4.0K 2010-10-26 11:29 certificate_requests/
drwxrwxr-x  3 puppet web-team 4.0K 2011-04-14 10:47 certs/
-rw-r--r--  1 puppet web-team  633 2011-04-14 10:47 crl.pem
drwxr-x---  3 puppet web-team 4.0K 2010-08-03 11:53 private/
drwxr-x---  3 puppet web-team 4.0K 2010-10-26 11:29 private_keys/
drwxrwxr-x  3 puppet web-team 4.0K 2010-10-26 11:29 public_keys/
drwxrwxr-x  6 puppet web-team 4.0K 2011-04-29 11:31 .svn/

Untitled Ruby on Rails (9-May @ 12:48)

Syntax Highlighted Code

  1. root@puppetmaster:~# find /var/lib/puppet/ ! -perm -g+r -ls
  2. root@puppetmaster:~# touch /var/lib/puppet/test && chmod 600 /var/lib/puppet/test
  3. root@puppetmaster:~# find /var/lib/puppet/ ! -perm -g+r -ls
  4. 153824    0 -rw-------   1 root     root            0 May  9 13:47 /var/lib/puppet/test
  5.  

Plain Code

root@puppetmaster:~# find /var/lib/puppet/ ! -perm -g+r -ls
root@puppetmaster:~# touch /var/lib/puppet/test && chmod 600 /var/lib/puppet/test
root@puppetmaster:~# find /var/lib/puppet/ ! -perm -g+r -ls
153824    0 -rw-------   1 root     root            0 May  9 13:47 /var/lib/puppet/test

Untitled Ruby on Rails (9-May @ 12:33)

Syntax Highlighted Code

  1. paula@puppetmaster:/var/lib/puppet/ssl$ ll /var/lib/puppet/ssl/private_keys/
  2. total 4.0K
  3. -rw-rw---- 1 puppet web-team 887 2010-10-26 11:29 puppetmaster.test.net.pem
  4.  
  5. [23 more lines...]

Plain Code

paula@puppetmaster:/var/lib/puppet/ssl$ ll /var/lib/puppet/ssl/private_keys/
total 4.0K
-rw-rw---- 1 puppet web-team 887 2010-10-26 11:29 puppetmaster.test.net.pem

paula@puppetmaster:/var/lib/puppet/ssl$ id paula
uid=738(paula) gid=815(web-team) groups=815(web-team),16(dialout),33(video)

paula@puppetmaster:/var/lib/puppet/ssl$ puppet kick s3p2197.test.net
Triggering s3p2197.test.net
warning: peer certificate won't be verified in this SSL session
Host s3p2197.test.net failed: Error 403 on SERVER: Forbidden request: PUPPETMASTER(10.xxxxxx.106) access to /run/s3p2197.test.net [save] at line 98
s3p2197.test.net finished with exit code 2


root@s3p2197:~# grep -5 /run /etc/puppet/auth.conf
path /certificate_request
auth no
method find, save
allow *

path /run
method save
allow *
#auth any

# this one is not stricly necessary, but it has the merit

Untitled Ruby on Rails (9-May @ 12:31)

Syntax Highlighted Code

  1. paula@s3p2106:/var/lib/puppet/ssl$ puppet kick s3p2197.test.net
  2. Triggering s3p2197.test.net
  3. warning: peer certificate won't be verified in this SSL session
  4. Host s3p2197.test.net failed: Error 403 on SERVER: Forbidden request: S3P2106(10.xxxxxx.106) access to /run/s3p2197.test.net [save] at line 98
  5. [14 more lines...]

Plain Code

paula@s3p2106:/var/lib/puppet/ssl$ puppet kick s3p2197.test.net
Triggering s3p2197.test.net
warning: peer certificate won't be verified in this SSL session
Host s3p2197.test.net failed: Error 403 on SERVER: Forbidden request: S3P2106(10.xxxxxx.106) access to /run/s3p2197.test.net [save] at line 98
s3p2197.test.net finished with exit code 2


root@s3p2197:~# grep -5 /run /etc/puppet/auth.conf
path /certificate_request
auth no
method find, save
allow *

path /run
method save
allow *
#auth any

# this one is not stricly necessary, but it has the merit

Untitled Ruby on Rails (28-Apr @ 15:04)

Syntax Highlighted Code

  1. define configfile(owner = 'styxp', group = 'web-team', mode = 644, source,
  2.                   backup = false, recurse = false, ensure = file) {
  3.     file { $name:
  4.             mode => $mode,
  5. [16 more lines...]

Plain Code

define configfile(owner = 'styxp', group = 'web-team', mode = 644, source,
                  backup = false, recurse = false, ensure = file) {
    file { $name:
            mode => $mode,
            owner => $owner,
            group => $group,
            backup => $backup,
            recurse => $recurse,
            ensure => $ensure,
            source => "puppet:///$linie/$source"
    }
}




$linie = "impuls-test"

configfile { "btm-config.properties": $source = "tc6_pmod/btm-config.properties" }

results in Syntax error at 'source'; expected '}'

Untitled Ruby on Rails (19-Apr @ 14:12)

Syntax Highlighted Code

  1. if $fqdn == "servera.test" {
  2.  
  3.       $vip2 = '242'
  4.       $vip3 = '245'
  5. [10 more lines...]

Plain Code

if $fqdn == "servera.test" {

      $vip2 = '242'
      $vip3 = '245'
      $vip4 = '243'
...
  }

  if $fqdn == "serverb.test" {

      $vip2 = '240'
      $vip3 = '244'
      $vip4 = '241'
...
}

Untitled Ruby on Rails (18-Feb @ 15:54)

Syntax Highlighted Code

  1. root@s3p2197:~# facter | grep ipaddress
  2. ipaddress => 10.125.122.197
  3. ipaddress_eth0 => 10.125.122.197
  4. ipaddress_eth1 => 10.135.122.197
  5. [25 more lines...]

Plain Code

root@s3p2197:~# facter | grep ipaddress
ipaddress => 10.125.122.197
ipaddress_eth0 => 10.125.122.197
ipaddress_eth1 => 10.135.122.197
root@s3p2197:~# /sbin/ifconfig
eth0      Link encap:Ethernet  HWaddr 00:50:56:AD:68:8C
          inet addr:10.125.122.197  Bcast:10.125.127.255  Mask:255.255.248.0
          inet6 addr: fe80::250:56ff:fead:688c/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:3839807954 errors:0 dropped:0 overruns:0 frame:0
          TX packets:2029224711 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:2265316611070 (2160374.2 Mb)  TX bytes:867807551582 (827605.7 Mb)
          Base address:0x1400 Memory:f4820000-f4840000

eth0:s3p2 Link encap:Ethernet  HWaddr 00:50:56:AD:68:8C
          inet addr:10.125.122.242  Bcast:10.125.127.255  Mask:255.255.248.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          Base address:0x1400 Memory:f4820000-f4840000

eth0:s3p2 Link encap:Ethernet  HWaddr 00:50:56:AD:68:8C
          inet addr:10.125.122.243  Bcast:10.125.127.255  Mask:255.255.248.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          Base address:0x1400 Memory:f4820000-f4840000

eth0:s3p2 Link encap:Ethernet  HWaddr 00:50:56:AD:68:8C
          inet addr:10.125.122.245  Bcast:10.125.127.255  Mask:255.255.248.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          Base address:0x1400 Memory:f4820000-f4840000

Untitled Ruby on Rails (15-Feb @ 15:12)

Syntax Highlighted Code

  1. include apps::politikportal
  2.  
  3.  
  4. # sed -n 5p /etc/puppet/modules/apps/manifests/politikportal.pp
  5. [8 more lines...]

Plain Code

include apps::politikportal


# sed -n 5p /etc/puppet/modules/apps/manifests/politikportal.pp
class politikportal {


# puppetd -t
notice: Ignoring --listen on onetime run
info: Retrieving plugin
err: Could not retrieve catalog from remote server: Error 400 on SERVER: Could not find class apps::politikportal at /etc/puppet/manifests/nodes.pp:26 on node s3p5228.enbw.net
warning: Not using cache on failed catalog
err: Could not retrieve catalog; skipping run

Untitled Ruby on Rails (14-Feb @ 10:34)

Syntax Highlighted Code

  1. line{ "nagios-passenger-crontab":
  2.       file => "/etc/crontab",
  3.       line => "\/2 * * * * root [ -x \/usr\/bin\/passenger-status ] && \/usr\/bin\/passenger-status 2>\/dev\/null | sed -n 2,2p | grep -E -o \"[0-9]*\" > \/tmp\/passenger-max",
  4.       ensure => absent
  5. [28 more lines...]

Plain Code

line{ "nagios-passenger-crontab":
      file => "/etc/crontab",
      line => "\/2 * * * * root [ -x \/usr\/bin\/passenger-status ] && \/usr\/bin\/passenger-status 2>\/dev\/null | sed -n 2,2p | grep -E -o \"[0-9]*\" > \/tmp\/passenger-max",
      ensure => absent
  }



define line($file, $line, $ensure = 'present') {
    case $ensure {
        default : { err ( "unknown ensure value ${ensure}" ) }
        present: {
            exec { "/bin/echo '${line}' >> '${file}'":
                unless => "/bin/grep -qFx '${line}' '${file}'"
            }
        }
        absent: {
          $line_no_slashes = slash_escape($line)

            exec { "/usr/bin/perl -ni -e 'print unless /^\\Q${line_no_slashes}\\E\$/' '${file}'":
                onlyif => "/bin/grep -qFx '${line}' '${file}'"
            }
        }
    }
}


notice: Ignoring --listen on onetime run
info: Retrieving plugin
err: Could not retrieve catalog from remote server: Error 400 on SERVER: Unknown function slash_escape at /etc/puppet/manifests/classes/definitions.pp:16 on node s3p3140.enbw.net
warning: Not using cache on failed catalog
err: Could not retrieve catalog; skipping run

Untitled Ruby on Rails (11-Jan @ 14:51)

Syntax Highlighted Code

  1. Manifest:
  2.   $apacheInstances = [ "apache22", "apache22_bv", "apache22_cmd", "apache22_dgw" ]
  3.   apacheconf { $apacheInstances: }
  4.  
  5. [25 more lines...]

Plain Code

Manifest:
  $apacheInstances = [ "apache22", "apache22_bv", "apache22_cmd", "apache22_dgw" ]
  apacheconf { $apacheInstances: }

# Apache config files shortcut
define apacheconf(owner = 'styxp', group = 'web-team', mode = 640,
                  backup = false, recurse = false, ensure = file) {

    file { "/etc/$name/apache22.conf":
            mode => $mode,
            owner => $owner,
            group => $group,
            backup => $backup,
            recurse => $recurse,
            ensure => $ensure,
            content => template("$linie/$name/apache22.conf")
    }
}


custom fact:
# !/bin/sh
for s in /etc/apache*; do echo -n `basename $s`,\ ; done;


gives back 

err: Could not retrieve catalog from remote server: Error 400 on SERVER: Could not find template 'impuls_test/apache22, apache22_bv, apache22_cmd, apache22_dgw, /apache22.conf' at /etc/puppet/manifests/classes/definitions.pp:64 on node s3p2196.enbw.net

Untitled Ruby on Rails (11-Jan @ 12:30)

Syntax Highlighted Code

  1. # Apache config files shortcut
  2. define apacheconf(owner = 'styxp', group = 'web-team', mode = 640,
  3.                   backup = false, recurse = false, ensure = file) {
  4.  
  5. [51 more lines...]

Plain Code

# Apache config files shortcut
define apacheconf(owner = 'styxp', group = 'web-team', mode = 640,
                  backup = false, recurse = false, ensure = file) {

 file { "/etc/$name/vhosts.inc":
            mode => $mode,
            owner => $owner,
            group => $group,
            backup => $backup,
            recurse => $recurse,
            ensure => $ensure,
            content => template("$linie/$name/vhosts.inc.erb"),
            notify => Service["$name"]
    } 

  # Apache graceful
    service { "$name":
            ensure => true,
            enable => true,
            hasrestart => true,
            restart => "/etc/init.d/$name graceful",
            subscribe => File["/etc/$name/vhosts.inc"],
            require => Exec["$name"],
    }

    # Apache configtest
    exec { "$name":
            command => "/etc/ini.t/$name configtest",
            refreshonly => true,
    }
}


root@s3p2196:~# puppetd -vt
notice: Ignoring --listen on onetime run
info: Retrieving plugin
info: Caching catalog for s3p2196.enbw.net
info: Applying configuration version '1294748894'
notice: /Stage[first]/Smart/Exec[smart-update]/returns: executed successfully
notice: /Stage[main]/Pakete/Package[nrpe]/ensure: created
notice: /Stage[main]/Pakete/Package[findutils]/ensure: created
--- /etc/apache22/vhosts.inc    2011-01-11 12:13:03.000000000 +0100
+++ /tmp/puppet-file20110111-25322-32u0lw-0     2011-01-11 13:28:16.000000000 +0100
@@ -374,3 +374,4 @@
   RewriteRule ^/(.*)         http://%{HTTP_HOST}.enbw.net/$1 [L,R]
 </VirtualHost>

+# vim: syntax=apache filetype=apache
notice: /Stage[main]/Impuls_test_s3p2196/Apacheconf[apache22]/File[/etc/apache22/vhosts.inc]/content: content changed '{md5}d2a9faa80e4517026eabde3893a90631' to '{md5}6f71378790e824946f89d685aa9e9f42'
info: /Stage[main]/Impuls_test_s3p2196/Apacheconf[apache22]/File[/etc/apache22/vhosts.inc]: Scheduling refresh of Service[apache22]
info: /Stage[main]/Impuls_test_s3p2196/Apacheconf[apache22]/File[/etc/apache22/vhosts.inc]: Scheduling refresh of Service[apache22]
notice: /Stage[main]/Impuls_test_s3p2196/Apacheconf[apache22]/Service[apache22]: Triggered 'refresh' from 2 events
notice: /Stage[main]/Pakete/Package[nagios-nbwplugins]/ensure: created
notice: /Stage[main]/Pakete/Package[strace]/ensure: created
notice: Finished catalog run in 7.26 seconds

Untitled Ruby on Rails (11-Jan @ 12:22)

Syntax Highlighted Code

  1. # Apache config files shortcut
  2. define apacheconf(owner = 'styxp', group = 'web-team', mode = 640,
  3.                   backup = false, recurse = false, ensure = file) {
  4.  
  5. [28 more lines...]

Plain Code

# Apache config files shortcut
define apacheconf(owner = 'styxp', group = 'web-team', mode = 640,
                  backup = false, recurse = false, ensure = file) {

 file { "/etc/$name/vhosts.inc":
            mode => $mode,
            owner => $owner,
            group => $group,
            backup => $backup,
            recurse => $recurse,
            ensure => $ensure,
            content => template("$linie/$name/vhosts.inc.erb"),
            notify => Service["apache-graceful"]
    }
}


# Apache graceful
service { "apache-graceful":
        ensure => true,
        enable => true,
        hasrestart => true,
        restart => "/etc/init.d/$name graceful",
        subscribe => File["/etc/$name/vhosts.inc"],
        require => Exec["apache-config-check"],
}

# Apache configtest
exec { "apache-config-check":
        command => "/etc/ini.t/$name configtest",
        refreshonly => true,
}

Untitled Ruby on Rails (11-Jan @ 12:13)

Syntax Highlighted Code

  1. file { "/etc/$name/vhosts.inc":
  2.             mode => $mode,
  3.             owner => $owner,
  4.             group => $group,
  5. [29 more lines...]

Plain Code

file { "/etc/$name/vhosts.inc":
            mode => $mode,
            owner => $owner,
            group => $group,
            backup => $backup,
            recurse => $recurse,
            ensure => $ensure,
            content => template("$linie/$name/vhosts.inc.erb"),
            notify => Service["apache-graceful"]
    }

# Apache graceful
service { "apache-graceful":
        ensure => true,
        enable => true,
        hasrestart => true,
        restart => "/etc/init.d/$name graceful",
        subscribe => File["/etc/$name/vhosts.inc"],
        require => Exec["apache-config-check"],
}

# Apache configtest
exec { "apache-config-check":
        command => "/etc/ini.t/$name configtest",
        refreshonly => true,
}

results in:
err: Could not run Puppet configuration client: Could not find dependency File[/etc/main/vhosts.inc] for Service[apache-graceful] at /etc/puppet/manifests/classes/definitions.pp:124
Which is this line:
  subscribe => File["/etc/$name/vhosts.inc"],

I need to refer to the name variable which gets used in the file ressource in the service ressource.

Untitled Ruby on Rails (11-Jan @ 11:02)

Syntax Highlighted Code

  1.    service { "httpd":
  2.             ensure => true,
  3.             enable => true,
  4.             hasrestart => true,
  5. [10 more lines...]

Plain Code

    service { "httpd":
            ensure => true,
            enable => true,
            hasrestart => true,
            restart => "/etc/init.d/$name graceful",
            subscribe => File["/etc/$name/vhosts.inc"]
    }


root@s3p2196:~# puppetd -vt
notice: Ignoring --listen on onetime run
info: Retrieving plugin
err: Could not retrieve catalog from remote server: Error 400 on SERVER: Duplicate definition: Service[httpd] is already defined in file /etc/puppet/manifests/classes/definitions.pp at line 119; cannot redefine at /etc/puppet/manifests/classes/definitions.pp:119 on node s3p2196.enbw.net
warning: Not using cache on failed catalog
err: Could not retrieve catalog; skipping run

Untitled Ruby on Rails (11-Jan @ 10:00)

Syntax Highlighted Code

  1. root@s3p2106:/etc/puppet/manifests# cat classes/base.pp
  2. # ----------------------------------------
  3. # classes/base.pp
  4. # ----------------------------------------
  5. [50 more lines...]

Plain Code

root@s3p2106:/etc/puppet/manifests# cat classes/base.pp
# ----------------------------------------
# classes/base.pp
# ----------------------------------------

class base {
  include smart
  include pakete
}

# run order
stage { "first": before => Stage[main] }
class {
    "smart": stage => first;
    "pakete": stage => main;
}



# puppet client config
class smart {
  if $fqdn != "s3p2106.enbw.net" {
    file { "puppet.conf":
            path => "/etc/puppet/puppet.conf",
            ensure   => present,
            owner => root,
            group => root,
            mode => 640,
            source => "puppet:///puppet-client/puppet.conf"
        }
  }


root@s3p2106:/etc/puppet/manifests# cat nodes.pp
# --------------------------------------------------
# nodes.pp
# --------------------------------------------------

import 'classes/*.pp'

case $operatingsystem {
  'SuSE': { Package { provider => yum } }
  'SLES': { case $operatingsystemrelease {
                '11.1': { Package { provider => zypper } }
                '10.1': { Package { provider => smart } }
            }
          }
}

node 's3p2106.enbw.net' {
      #include base
      include paula-conf
}

Untitled Ruby on Rails (21-Dec @ 13:37)

Syntax Highlighted Code

  1. root@sxxx6:/etc/puppet/modules/impuls_test# ll tc6_combv/files/catalina.policy
  2. -rw-rw-r-- 1 puppet web-team 8.4K 2010-12-10 15:54 tc6_combv/files/catalina.policy
  3. root@s3p2106:/etc/puppet/modules/impuls_test# ll files/catalina.policy
  4. -rw-rw-r-- 1 puppet web-team 8.4K 2010-12-06 13:52 files/catalina.policy
  5. [16 more lines...]

Plain Code

root@sxxx6:/etc/puppet/modules/impuls_test# ll tc6_combv/files/catalina.policy
-rw-rw-r-- 1 puppet web-team 8.4K 2010-12-10 15:54 tc6_combv/files/catalina.policy
root@s3p2106:/etc/puppet/modules/impuls_test# ll files/catalina.policy
-rw-rw-r-- 1 puppet web-team 8.4K 2010-12-06 13:52 files/catalina.policy



definitions.pp:
$line = "impuls_test"
file { "/tmp/$name-catalina.policy":
            mode => $mode,
            owner => $owner,
            group => $group,
            backup => $backup,
            recurse => $recurse,
            ensure => $ensure,
            # TODO tc6_combv why doesn't it look for the specific file source?
            # It works, when I use puppet:///$line/catalina.policy, but I need to be more specific.
            source => [ "puppet:///$line/$name/catalina.policy", "puppet:///default/catalina.policy" ]
    }

iftikhar uppal (22-Aug @ 03:17)

Syntax Highlighted Code

  1. Hi...........

Plain Code

Hi...........

Untitled Ruby on Rails (16-Apr @ 10:28)

Syntax Highlighted Code

  1. a

Plain Code

a

Untitled Ruby on Rails (26-Mar @ 15:41)

Syntax Highlighted Code

  1. hello world.

Plain Code

hello world.

test blah (15-Jul @ 20:50)

Syntax Highlighted Code

  1. ueaou
  2. ao
  3. ueaoeaou
  4. eou
  5. [4 more lines...]

Plain Code

ueaou
ao
ueaoeaou
eou
eaou
eou
eou

BTW ruby on rails sucks :)

Untitled Ruby on Rails (24-Sep @ 20:56)

Syntax Highlighted Code

  1. def ddd
  2.  
  3. end
  4.  

Plain Code

def ddd

end

Untitled Ruby on Rails (23-Sep @ 19:41)

Syntax Highlighted Code

  1. def alabala
  2.   "Alabala!"
  3. end

Plain Code

def alabala
  "Alabala!"
end

Untitled Ruby on Rails (22-Sep @ 17:39)

Syntax Highlighted Code

  1. def index
  2.  renter :text => "Ciaoooo"
  3. end

Plain Code

def index
 renter :text => "Ciaoooo"
end

Untitled Ruby on Rails (14-Aug @ 20:25)

Syntax Highlighted Code

  1. class ArticlesController < ApplicationController
  2.   before_filter :login_required
  3.   layout "admin"
  4.  
  5. [89 more lines...]

Plain Code

class ArticlesController < ApplicationController
  before_filter :login_required
  layout "admin"

  
  # GET /articles
  # GET /articles.xml
  def index
    #TODO horrible! need refactoring
    if current_user.has_role?('admin')
      @articles = Article.find(:all)
    else  
      @articles = Article.find_all_by_user_id(current_user)
    end  
      
    respond_to do |format|
      format.html # index.html.erb
      format.xml  { render :xml => @articles }
    end
  end

  # GET /articles/1
  # GET /articles/1.xml
  def show
    @article = Article.find(params[:id])

    respond_to do |format|
      format.html # show.html.erb
      format.xml  { render :xml => @article }
    end
  end

  # GET /articles/new
  # GET /articles/new.xml
  def new
    @article = Article.new
    respond_to do |format|
      format.html # new.html.erb
      format.xml  { render :xml => @article }
    end
  end

  # GET /articles/1/edit
  def edit
    @article = Article.find(params[:id])
  end

  # POST /articles
  # POST /articles.xml
  def create
    @article = Article.new(params[:article])
    @article.user = current_user
    respond_to do |format|
      if @article.save
        flash[:notice] = 'Article was successfully created.'
        format.html { redirect_to(@article) }
        format.xml  { render :xml => @article, :status => :created, :location => @article }
      else
        format.html { render :action => "new" }
        format.xml  { render :xml => @article.errors, :status => :unprocessable_entity }
      end
    end
  end

  # PUT /articles/1
  # PUT /articles/1.xml
  def update
    @article = Article.find(params[:id])

    respond_to do |format|
      if @article.update_attributes(params[:article])
        flash[:notice] = 'Article was successfully updated.'
        format.html { redirect_to(@article) }
        format.xml  { head :ok }
      else
        format.html { render :action => "edit" }
        format.xml  { render :xml => @article.errors, :status => :unprocessable_entity }
      end
    end
  end

  # DELETE /articles/1
  # DELETE /articles/1.xml
  def destroy
    @article = Article.find(params[:id])
    @article.destroy

    respond_to do |format|
      format.html { redirect_to(articles_url) }
      format.xml  { head :ok }
    end
  end
end

Untitled Ruby on Rails (28-Jul @ 10:23)

Syntax Highlighted Code

  1. if x=17 when y=97 then x=22 no.syntax.gyst

Plain Code

if x=17 when y=97 then x=22 no.syntax.gyst

Untitled Ruby on Rails (28-Jul @ 10:22)

Syntax Highlighted Code

  1. if dirty.me

Plain Code

if dirty.me

Untitled Ruby on Rails (26-Jun @ 16:00)

Syntax Highlighted Code

  1. p

Plain Code

p

Untitled Ruby on Rails (26-Jun @ 15:50)

Syntax Highlighted Code

  1. asd

Plain Code

asd