This file contains 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
#!/usr/bin/ruby | |
require 'openssl' | |
require 'osx/cocoa' | |
include OSX | |
plain_text_pass = 'foobar' | |
file = 'user.plist' | |
user_plist = NSDictionary.dictionaryWithContentsOfFile(file) |
This file contains 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
# Simple Provider | |
require 'fileutils' | |
Puppet::Type.type(:simple).provide(:simple) do | |
desc "Provides simple useless file creation" | |
def create | |
notice("Creating: #{resource[:name]}") | |
system('/usr/bin/touch', "#{resource[:path]}/#{resource[:name]}") | |
end |
This file contains 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
#!/usr/bin/ruby | |
# This code comes with no guarantees and it is not a "fix", just a workaround. | |
# It would be trivial to replace the patched file and restore these debugging messages. | |
# Also, this script modifies a Mac OS X System file, so... | |
require 'etc' | |
require 'fileutils' | |
require 'syslog' | |
@log = Syslog.open('patchhomedirmech') |
This file contains 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
#!/usr/bin/ruby | |
require 'osx/cocoa' | |
require 'pp' | |
require 'delegate' | |
load './password.rb' | |
include OSX | |
def load_plist(file) |
This file contains 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 'pp' | |
require 'osx/cocoa' | |
include OSX | |
class DSLocalPassword | |
attr_reader :content | |
@@macosx_major_version = 10.7 | |
@@password_create_methods = { |
This file contains 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
[15:18:01] bcw$ ~/Desktop/foo.rb | |
/Library/Ruby/Gems/2.0.0/gems/CFPropertyList-2.2.5/lib/rbREXMLParser.rb:101:in `block in import_xml': Format error! (CFFormatError) | |
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rexml/element.rb:905:in `block in each' | |
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rexml/xpath.rb:67:in `each' | |
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rexml/xpath.rb:67:in `each' | |
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rexml/element.rb:905:in `each' | |
from /Library/Ruby/Gems/2.0.0/gems/CFPropertyList-2.2.5/lib/rbREXMLParser.rb:93:in `import_xml' | |
from /Library/Ruby/Gems/2.0.0/gems/CFPropertyList-2.2.5/lib/rbREXMLParser.rb:102:in `block in import_xml' | |
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rexml/element.rb:905:in `block in each' | |
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rexml/x |
This file contains 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
newproperty(:shared) do | |
newvalue(true, false) | |
def insync?(is) | |
puts "You will never get here." | |
end | |
munge do |value| | |
@resource.munge_boolean(value) | |
end |
This file contains 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
# Edit the target variable to point to your AD domain | |
# Adjust timeout (less than max_timeout) and port as appropriate. | |
# Could be used to test any service really... | |
# | |
# We return Strings, strange? Yes. Facter doesn't like booleans and Hiera can't interpolate | |
# anything other than strings. | |
# Everything in Strings! | |
require 'puppet' | |
require 'socket' |
This file contains 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 'puppet' | |
Facter.add("node_id") do | |
confine :operatingsystem => :darwin | |
setcode do | |
primary_mac = Facter[:macaddress].value.delete(':') | |
"node-#{primary_mac}" | |
end | |
end |
This file contains 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
# Change the value of the `target` variable | |
require 'puppet' | |
require 'socket' | |
require 'timeout' | |
Facter.add("domain_available?") do | |
confine :operatingsystem => :darwin | |
setcode do | |
class Ping |
OlderNewer