This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| File { | |
| require => Exec['myexec'], | |
| } | |
| <file declarations> | |
| <exec declaration> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # -*- mode: ruby -*- | |
| # vi: set ft=ruby : | |
| # Vagrantfile API/syntax version. Don't touch unless you know what you're doing! | |
| VAGRANTFILE_API_VERSION = "2" | |
| Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| | |
| config.vm.box = 'centos' | |
| # Fusion Settings |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ----------FUNCTION---------- | |
| Puppet::Parser::Functions.newfunction(:extract, :type => :rvalue, :doc => "Extract it!") do |args| | |
| raise Puppet::ParseError, "Please pass 2 arguments to the extract function, not #{args.length}" unless args.length == 2 | |
| yaml_file = args[0] | |
| yaml_field = args[1] | |
| raise Puppet::ParseError, "File #{yaml_file} not accessible to the extract function" unless File.exist?(yaml_file) and File.readable?(yaml_file) | |
| yaml_hash = YAML.load_file(yaml_file) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'rspec-puppet' | |
| #require 'puppetlabs_spec_helper/puppetlabs_spec/puppet_internals' | |
| # Works even without ^^^ | |
| scope = PuppetlabsSpec::PuppetInternals.scope | |
| Puppet::Parser::Functions.autoloader.load(:extract) | |
| scope.function_extract(['/var/tmp/test.yaml', 'name']) | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (~/src/facter)▷ irb | |
| >> require 'facter' | |
| => true | |
| >> require 'puppet' | |
| => true | |
| >> require 'facter/util/cfpropertylist' | |
| => true | |
| >> data = ['foo', 'bar'] | |
| => ["foo", "bar"] | |
| >> plist = Facter::Util::CFPropertyList::List.new |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (~/src/veewee)▷ bundle exec vagrant basebox build osx --force [35/9654] | |
| [osx] Downloading vbox guest additions iso v 4.1.22 - http://download.virtualbox.org/virtualbox/4.1.22/VBoxGuestAdditions_4.1.22.iso | |
| [osx] Checking if isofile VBoxGuestAdditions_4.1.22.iso already exists. | |
| [osx] Full path: /Users/glarizza/src/veewee/iso/VBoxGuestAdditions_4.1.22.iso | |
| [osx] | |
| [osx] The isofile VBoxGuestAdditions_4.1.22.iso already exists. | |
| [osx] Building Box osx with Definition osx: | |
| [osx] - force : true | |
| [osx] | |
| [osx] The isofile OSX_InstallESD_10.8.2.dmg already exists. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| property_list_key { 'netboot_enabled': | |
| ensure => present, | |
| path => '/etc/bootpd', | |
| key => 'netboot_enabled', | |
| value => $interface, | |
| value_type => 'array', | |
| } | |
| property_list_key { 'startTime': | |
| ensure => present, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Put this in a module in your modulepath | |
| # Drop this file inside a module's 'lib/facter' directory | |
| # Run Puppet to sync down the custom fact | |
| # The fact is accessible in your code as $time_now or absolutely as $::time_now | |
| Facter.add('time_now') do | |
| setcode do | |
| t = Time.now | |
| t.strftime("%H:%M.%S") | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Ruby 1.9.3: | |
| irb(main):001:0> string = 'foo' | |
| => "foo" | |
| irb(main):002:0> string.each { |bar| puts bar } | |
| NoMethodError: undefined method `each' for "foo":String | |
| from (irb):2 | |
| from /opt/boxen/rbenv/versions/1.9.3/bin/irb:12:in `<main>' | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| property_list_key { 'Desktop Picture': | |
| ensure => present, | |
| path => '/Library/Preferences/com.apple.loginwindow', | |
| key => 'DesktopPicture', | |
| value => '/Library/Desktop Pictures/Ripples Blue.jpg', | |
| } |