Skip to content

Instantly share code, notes, and snippets.

@nickanderson
Created February 22, 2012 18:59
Show Gist options
  • Save nickanderson/1886657 to your computer and use it in GitHub Desktop.
Save nickanderson/1886657 to your computer and use it in GitHub Desktop.
Segfault produced
cf3> Cfengine - autonomous configuration engine - commence self-diagnostic prelude
cf3> ------------------------------------------------------------------------
cf3> Work directory is /home/cmdln/.cfagent
cf3> Making sure that locks are private...
cf3> Checking integrity of the state database
cf3> Checking integrity of the module directory
cf3> Checking integrity of the PKI directory
cf3> Looking for a source of entropy in /home/cmdln/.cfagent/randseed
cf3> -> Loaded private key /home/cmdln/.cfagent/ppkeys/localhost.priv
cf3> -> Loaded public key /home/cmdln/.cfagent/ppkeys/localhost.pub
cf3> Setting cfengine default port to 5308 = 5308
cf3> Reference time set to Wed Feb 22 12:40:55 2012
cf3> CFEngine Core 3.2.1
cf3> ------------------------------------------------------------------------
cf3> Host name is: ThinkPad-W520
cf3> Operating System Type is linux
cf3> Operating System Release is 3.0.0-16-generic
cf3> Architecture = x86_64
cf3> Using internal soft-class linux for host ThinkPad-W520
cf3> The time is now Wed Feb 22 12:40:55 2012
cf3> ------------------------------------------------------------------------
cf3> # Extended system discovery is only available in version Nova and above
cf3> Additional hard class defined as: 64_bit
cf3> Additional hard class defined as: linux_3_0_0_16_generic
cf3> Additional hard class defined as: linux_x86_64
cf3> Additional hard class defined as: linux_x86_64_3_0_0_16_generic
cf3> GNU autoconf class from compile time: compiled_on_linux_gnu
cf3> Hostname lookup failed on node name "ThinkPad-W520"
cf3> Interface 1: lo
cf3> Interface 2: eth0
cf3> Interface 3: vmnet1
cf3> Interface 4: vmnet8
cf3> Interface 5: tun0
cf3> Trying to locate my IPv6 address
cf3> Found IPv6 address fe80::f2de:f1ff:fe7d:9806
cf3> Found IPv6 address fe80::250:56ff:fec0:1
cf3> Found IPv6 address fe80::250:56ff:fec0:8
cf3> Looking for environment from cf-monitord...
cf3> Unable to detect environment from cf-monitord
cf3> This appears to be a debian system.
cf3> Looking for Debian version...
cf3> This system seems to have the aptitude package system
cf3> This appears to be a VMware Server ESX/xSX system.
cf3> ***********************************************************
cf3> Loading persistent classes
cf3> ***********************************************************
cf3> ***********************************************************
cf3> Loaded persistent memory
cf3> ***********************************************************
cf3> -> No policy server (hub) watch yet registered
cf3> -> Input file is outside default repository, validating it
cf3> -> Promises seem to change
cf3> -> Input file is changed since last validation, validating it
cf3> -> Verifying the syntax of the inputs...
cf3> Checking policy with command ""/home/cmdln/.cfagent/bin/cf-promises" -f "./set_variable_values_ini_region.cf""
cf3> -> Caching the state of validation
cf3> > Parsing file ./set_variable_values_ini_region.cf
cf3> Initiate variable convergence...
cf3> > Parsing file ./cfengine_stdlib.cf
cf3> Initiate variable convergence...
cf3> Initiate variable convergence...
cf3> # Knowledge map reporting feature is only available in version Nova and above
cf3> -> Defined classes = { 10_13_120_134 172_16_120_1 192_168_89_1 64_bit Afternoon Day22 February GMT_Hr18 Hr12 Hr12_Q3 Lcycle_2 Min40 Min40_45 PK_MD5_9ae619367f1a3250279fc50408b540b0 Q3 ThinkPad_W520_local Ubuntu_11_10__n__l VMware Wednesday Yr2012 agent any cfengine cfengine_3 cfengine_3_2 cfengine_3_2_1 community_edition compiled_on_linux_gnu debian debian_wheezy fe80__250_56ff_fec0_1 fe80__250_56ff_fec0_8 fe80__f2de_f1ff_fe7d_9806 have_aptitude inform_mode ipv4_10 ipv4_10_13 ipv4_10_13_120 ipv4_10_13_120_134 ipv4_172 ipv4_172_16 ipv4_172_16_120 ipv4_172_16_120_1 ipv4_192 ipv4_192_168 ipv4_192_168_89 ipv4_192_168_89_1 linux linux_3_0_0_16_generic linux_x86_64 linux_x86_64_3_0_0_16_generic linux_x86_64_3_0_0_16_generic__28_Ubuntu_SMP_Fri_Jan_27_17_44_39_UTC_2012 localdomain localhost_localdomain net_iface_eth0 net_iface_tun0 net_iface_vmnet1 net_iface_vmnet8 thinkpad_w520 thinkpad_w520_localdomain ubuntu ubuntu_11 ubuntu_11_10 verbose_mode x86_64 }
cf3> -> Negated Classes = { }
cf3> Initiate variable convergence...
cf3> -> Immunizing against parental death
cf3> -> Bundlesequence => {'main'}
cf3>
cf3> *****************************************************************
cf3> BUNDLE main
cf3> *****************************************************************
cf3>
cf3>
cf3> =========================================================
cf3> vars in bundle main (1)
cf3> =========================================================
cf3>
cf3>
cf3> + Private classes augmented:
cf3>
cf3> - Private classes diminished:
cf3>
cf3>
cf3>
cf3> =========================================================
cf3> files in bundle main (1)
cf3> =========================================================
cf3>
cf3>
cf3> .........................................................
cf3> Promise handle:
cf3> Promise made by: /tmp/testfile
cf3>
cf3> Comment: Set the variale values only in the specified ini region
cf3> .........................................................
cf3>
cf3> -> Using literal pathtype for /tmp/testfile
cf3> -> Handling file existence constraints on /tmp/testfile
cf3> -> Handling file edits in edit_line bundle set_variable_values_ini_region
cf3>
cf3> * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
cf3> BUNDLE set_variable_values_ini_region( {'main.setting','region1'} )
cf3> * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
cf3>
cf3> Initiate variable convergence...
cf3> ? Augment scope set_variable_values_ini_region with v (s)
cf3> ? Augment scope set_variable_values_ini_region with r (s)
cf3>
cf3> = = = = = = = = = = = = = = = = = = = = = = = = = = = =
cf3> vars in bundle set_variable_values_ini_region
cf3> = = = = = = = = = = = = = = = = = = = = = = = = = = = =
cf3>
cf3>
cf3> .........................................................
cf3> Promise handle:
cf3> Promise made by: index
cf3> .........................................................
cf3>
cf3>
cf3> .........................................................
cf3> Promise handle:
cf3> Promise made by: cindex[enabled]
cf3> .........................................................
cf3>
cf3> ?? Private class context
cf3>
cf3>
cf3> = = = = = = = = = = = = = = = = = = = = = = = = = = = =
cf3> field_edits in bundle set_variable_values_ini_region
cf3> = = = = = = = = = = = = = = = = = = = = = = = = = = = =
cf3>
cf3>
cf3> .........................................................
cf3> Promise handle:
cf3> Promise made by: \s*enabled\s*=.*
cf3>
cf3> Comment: Match a line starting like key = something
cf3> .........................................................
cf3>
cf3> - Matched line (enabled =1)
cf3> -> Stopped at field 2
cf3> -> Setting field sub-value 0 in /tmp/testfile
cf3> -> Edited field inside file object /tmp/testfile
cf3> ?> defining promise result class enabled_in_file
Segmentation fault
body common control {
bundlesequence => {
"main",
};
inputs => {
"cfengine_stdlib.cf",
};
}
bundle agent main {
vars:
"file" string => "/tmp/testfile";
"setting[enabled]" string => "0";
files:
"$(file)"
edit_line => set_variable_values_ini_region("main.setting", "region1"),
comment => "Set the variale values only in the specified ini region";
}
bundle edit_line set_variable_values_ini_region(v,r){
# Sets the RHS of variables in the file of the form
# LHS = RHS
# Adds a new line if no LHS exists, repairs RHS values if one does exist
#
# To use:
# 1) Define an array, where the keys are the LHS and the values are the RHS
# "stuff[lhs-1]" string => "rhs1";
# "stuff[lhs-2]" string => "rhs2";
# 2) The parameter passed to the edit_line promise is the fully qualified
# name of the array (i.e., "bundlename.stuff") WITHOUT any "$" or "@"
vars:
"index" slist => getindices("$(v)");
# Be careful if the index string contains funny chars
"cindex[$(index)]" string => canonify("$(index)");
field_edits:
# match a line starting like the key = something
"\s*$(index)\s*=.*"
edit_field => col("=","2","$($(v)[$(index)])","set"),
classes => if_ok("$(cindex[$(index)])_in_file"),
select_region => INI_section("$(r)"),
comment => "Match a line starting like key = something";
insert_lines:
"$(index)=$($(v)[$(index)])",
comment => "Insert a variable definition",
select_region => INI_section("$(r)"),
ifvarclass => "!$(cindex[$(index)])_in_file";
}
[region1]
enabled =1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment