Language: Ruby on Rails
Untitled Ruby on Rails (21-Mar @ 05:39)
Syntax Highlighted Code
- Ž h L 8 $
- ô Þ Î ´ – x ^ D 8 0 & s ñÍ[J % à à h H RSDSH,”ÂZ÷Jš°Ï€jš3 wiatwain.pdb * ‹ÿU‹ì¸csmà9Eu
- ÿuPèe YY]Ã3À]ÃÌÌÌÌÌ‹ÿU‹ìV‹u3Àë…Àu‹…ÉtÿуÆ;urì^]ÃÌÌÌÌÌh€ ÿD Y£@# £<# …Àu@à 3ÀÃÌÌÌÌÌ‹ÿU‹ìS3ÀVW9Eu&9 ~ÿ
- ‹=( P¾8# éå 3ÀéK ƒ}…> d‹
- [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
ÿuPèe YY]Ã3À]ÃÌÌÌÌÌ‹ÿU‹ìV‹u3Àë…Àu‹…ÉtÿуÆ;urì^]ÃÌÌÌÌÌh€ ÿD Y£@# £<# …Àu@à 3ÀÃÌÌÌÌÌ‹ÿU‹ìS3ÀVW9Eu&9 ~ÿ
‹=( P¾8# éå 3ÀéK ƒ}…> d‹
‹Y‹=( ‰EP¾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ð èš ‹M3Ò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ü9ut
ƒ}…€ Ç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ÒWD…ö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
- public class foo()
- {
- }
Plain Code
public class foo()
{
}
Untitled Ruby on Rails (3-Mar @ 07:39)
Syntax Highlighted Code
- # SQLite version 3.x
- # gem install sqlite3
- #
- # Ensure the SQLite 3 gem is defined in your Gemfile
- [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 (17-Nov @ 09:40)
Syntax Highlighted Code
- <%= jvm_params['xmx'] %>
- <% if has_variable?("$jvm_params['mxm']") then %>
- checktype1=<%= jvm_params['xmx'] %>
- [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
- ## config/database.yml
- login: &login
- adapter: mysql
- [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 (9-May @ 13:16)
Syntax Highlighted 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
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
- 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. <
- [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
- 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 ../
- [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
- 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
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
- 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
- [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
- 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
- [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
- define configfile(owner = 'styxp', group = 'web-team', mode = 644, source,
- backup = false, recurse = false, ensure = file) {
- file { $name:
- mode => $mode,
- [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
- if $fqdn == "servera.test" {
- $vip2 = '242'
- $vip3 = '245'
- [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
- root@s3p2197:~# facter | grep ipaddress
- ipaddress => 10.125.122.197
- ipaddress_eth0 => 10.125.122.197
- ipaddress_eth1 => 10.135.122.197
- [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
- include apps::politikportal
- # sed -n 5p /etc/puppet/modules/apps/manifests/politikportal.pp
- [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
- 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
- [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
- Manifest:
- $apacheInstances = [ "apache22", "apache22_bv", "apache22_cmd", "apache22_dgw" ]
- apacheconf { $apacheInstances: }
- [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
- # Apache config files shortcut
- define apacheconf(owner = 'styxp', group = 'web-team', mode = 640,
- backup = false, recurse = false, ensure = file) {
- [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
- # Apache config files shortcut
- define apacheconf(owner = 'styxp', group = 'web-team', mode = 640,
- backup = false, recurse = false, ensure = file) {
- [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
- file { "/etc/$name/vhosts.inc":
- mode => $mode,
- owner => $owner,
- group => $group,
- [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
- service { "httpd":
- ensure => true,
- enable => true,
- hasrestart => true,
- [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
- root@s3p2106:/etc/puppet/manifests# cat classes/base.pp
- # ----------------------------------------
- # classes/base.pp
- # ----------------------------------------
- [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
- 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
- [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" ]
}
Untitled Ruby on Rails (26-Mar @ 15:41)
Syntax Highlighted Code
- hello world.
Plain Code
hello world.
test blah (15-Jul @ 20:50)
Syntax Highlighted Code
- ueaou
- ao
- ueaoeaou
- eou
- [4 more lines...]
Plain Code
ueaou
ao
ueaoeaou
eou
eaou
eou
eou
BTW ruby on rails sucks :)
Untitled Ruby on Rails (23-Sep @ 19:41)
Syntax Highlighted Code
- def alabala
- "Alabala!"
- end
Plain Code
def alabala
"Alabala!"
end
Untitled Ruby on Rails (22-Sep @ 17:39)
Syntax Highlighted Code
- def index
- renter :text => "Ciaoooo"
- end
Plain Code
def index
renter :text => "Ciaoooo"
end
Untitled Ruby on Rails (14-Aug @ 20:25)
Syntax Highlighted Code
- class ArticlesController < ApplicationController
- before_filter :login_required
- layout "admin"
- [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
- 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