Skip to content

Instantly share code, notes, and snippets.

Ethan J. Brown Iristyle

  • Puppet, Inc.
  • Portland, OR
View GitHub Profile
@Iristyle
Iristyle / gotchas.md
Last active Feb 28, 2019
Migrating Emby from Diskstation package to Docker Container
View gotchas.md
@Iristyle
Iristyle / docker-helpers.ps1
Last active Sep 14, 2018
Docker / LCOW helpers for Windows
View docker-helpers.ps1
function Get-DockerConfigFilePath
{
$path = "${ENV:ALLUSERSPROFILE}\docker\config\daemon.json"
# retrieve the path to daemon.json from docker service config, if present
sc.exe qc docker |
? { $_ -match 'BINARY_PATH_NAME\s*:\s*(.*)' } |
? { $_ -match '--config-file\s*(.*daemon\.json)' }
# found BINARY_PATH_NAME which contains --config-file *AND* file exists
@Iristyle
Iristyle / Pluginsync as Administrator.txt
Created Aug 1, 2018
Pluginsyc as admin vs pluginsync as SYSTEM permission differences
View Pluginsync as Administrator.txt
Path : Microsoft.PowerShell.Core\FileSystem::C:\ProgramData\PuppetLabs\code
Owner : NT AUTHORITY\SYSTEM
Group : NT AUTHORITY\SYSTEM
Sddl : O:SYG:SYD:P(A;OICI;FA;;;SY)(A;OICI;FA;;;BA)
Path : Microsoft.PowerShell.Core\FileSystem::C:\ProgramData\PuppetLabs\facter
Owner : NT AUTHORITY\SYSTEM
Group : NT AUTHORITY\SYSTEM
@Iristyle
Iristyle / notes.md
Created Jul 13, 2018
Puppet::Util::Platform.windows? vs Puppet.features.microsoft_windows?
View notes.md

So we have 2 mechanisms that we use to check whether or not we're on Windows.

In this particular instance, I think we'd prefer to use Puppet::Util::Platform.windows? as I wouldn't expect any cross-platform stubbing to occur in tests.

@Iristyle
Iristyle / get-tasks-with-compat.ps1
Created Mar 28, 2018
Get scheduled tasks with compat
View get-tasks-with-compat.ps1
Get-ScheduledTask | % {
$props = [ordered]@{
TaskName = $psitem.TaskName
# note ErrorAction Ignore needed to prevent conversion problems
Compatibility = $psitem | Select -ExpandProperty Settings | Select -ExpandProperty Compatibility -ErrorAction Ignore
}
New-Object -TypeName PSObject -Property $props
}
@Iristyle
Iristyle / appv-notes.md
Last active Mar 24, 2018
Fun times with Bundler + AppVeyor!
View appv-notes.md

While documenting Bundler behavior to make the chart at https://gist.github.com/Iristyle/8a2214a6dd5aa709ba2a1abd32b4eacd, an interesting scenario was uncovered.

The following diff is a result of running the same code a day apart in AppVeyor. All dependencies downloaded / installed are exactly the same, except:

@Iristyle
Iristyle / bundler-results.md
Last active Mar 26, 2018
Windows Bundler 1.16.1 behavior when transitive dependency aws-sdk-v1 is present (that has json ~> 1.4)
View bundler-results.md
Gemfile gem fetched /
native ext built
--path specified Gemfile.lock system json bundled json gem list bundle exec gem list bundle show json
Ruby 2.1 /
json 1.8.1
gem 'json', '>= 0' fetched 1.8.6
built 1.8.6
json (1.8.6) 1.8.6 1.8.6 (1.8.6, default: 1.8.1) (1.8.6) C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/json-1.8.6
Ruby 2.4 /
json 2.0.4
gem 'json', '>= 0' fetched 1.8.6
built 1.8.6
json (1.8.6) 2.0.4 1.8.6 (default: 2.0.4, 1.8.6) (1.8.6) C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/json-1.8.6
Ruby 2.1 /<b
@Iristyle
Iristyle / triggers.md
Last active Mar 20, 2018
Scheduled Task Trigger Types
View triggers.md

Puppet Hash Definition

  • required parameter
  • example value
Type Format Example v1
TASK_TRIGGER
v2
ITrigger
schedule string enum daily
weekly
monthly
once
TriggerType Type
start_time time string HH:MM 13:21 wStartHour
wStartMinute
StartBoundary
start_date Date string YYYY-MM-DD 2011-08-31 wBeginYear
wBeginMonth
wBeginDay
StartBoundary
@Iristyle
Iristyle / test-installer.ps1
Created Feb 12, 2018
Install Puppet via MSI using CLI parameters
View test-installer.ps1
$hostname = [Net.Dns]::GetHostName()
function Install-Puppet($opts)
{
$params = @('/qn', '/i', 'pkg\puppet-agent.msi', '/l*v', 'install.log')
if ($opts.Account) { $params += "PUPPET_AGENT_ACCOUNT_USER=`"$($opts.Account)`"" }
if ($opts.Domain) { $params += "PUPPET_AGENT_ACCOUNT_DOMAIN=`"$($opts.Domain)`"" }
if ($opts.Password) { $params += "PUPPET_AGENT_ACCOUNT_PASSWORD=`"$($opts.Password)`"" }
if ($opts.Startup) { $params += "PUPPET_AGENT_STARTUP_MODE=`"$($opts.Startup)`"" }
@Iristyle
Iristyle / git-filter-for-specific-files.md
Created Jan 26, 2018
Demonstrate how to use Git to create a new repo with specific files from a current repo
View git-filter-for-specific-files.md

I tried to initially do this using the perl based cj-git-filter-branch tool from https://github.com/pflanze/chj-bin (which required ensuring Perl was viable and a few CPAN packages were installed) with a CLI invocation like:

~/source/chj/chj-bin/cj-git-filter-branch --remove-all-but-those-in ../keepers.txt -f

And a keepers.txt like:

acceptance/tests/resource/scheduled_task/should_create.rb
You can’t perform that action at this time.