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
| const validation: BaseParameter = { | |
| type: "string", | |
| required: true, | |
| }; | |
| const trueFalse: BaseParameter = { | |
| ...validation, | |
| type: { | |
| kind: "single", | |
| options: [ |
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
| // Starting polling | |
| const result = new Deferred<string>(); | |
| const timer = setInterval(async () => { | |
| ... | |
| const deploymentStatus = await httpClient.exchange<any>(`${someurl}/${somepath}`, { | |
| method: HttpMethod.Get, | |
| headers: { | |
| Accept: "application/json", | |
| }, | |
| }); |
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
| interface BitbucketWebhookResponse { | |
| id: number; | |
| name: string; | |
| createdDate: number; | |
| updatedDate: number; | |
| events: string[]; | |
| configuration: any; | |
| url: string; | |
| active: boolean; | |
| } |
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
| export const messageMaker: MessageMaker = params => { | |
| return { | |
| attachments: [ | |
| { | |
| text: params.text, | |
| color: "#45B254", | |
| fallback: "Fingerprint Update", | |
| mrkdwn_in: ["text"], | |
| actions: [ | |
| actionableButton( |
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
| node_group { 'PE Master': | |
| ensure => 'present', | |
| classes => { | |
| 'pe_repo' => {}, | |
| 'pe_repo::platform::el_7_x86_64' => {}, | |
| 'pe_repo::platform::windows_x86_64' => {}, | |
| 'puppet_enterprise::profile::master' => { | |
| 'code_manager_auto_configure' => true, | |
| 'r10k_private_key' => '/etc/puppetlabs/puppetserver/ssh/id-control_repo.rsa', | |
| 'r10k_remote' => 'https://gitlab.com/ipcrm/cd4pe-hol-cr.git', |
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
| module Puppet::Parser::Functions | |
| newfunction(:group_merge, :type => :rvalue, :doc => <<-'ENDHEREDOC') do |args| | |
| Recursively merges two or more hashes together and returns the resulting hash. | |
| For example: | |
| $hash1 = {'one' => 1, 'two' => 2, 'three' => { 'four' => 4 } } | |
| $hash2 = {'two' => 'dos', 'three' => { 'five' => 5 } } | |
| $merged_hash = group_merge($hash1, $hash2) | |
| # The resulting hash is equivalent to: |
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
| puppet query \ | |
| 'resources[title]{ (title ~ "^Profile*" or title ~ "^Role*" ) and certname = "master.inf.puppet.vm" group by certname,title }'\ | |
| | jq '.. | .title?' | |
| ``` | |
| "Profile::App::Webserver::Apache" | |
| "Profile::App::Webserver::Apache::Php" | |
| "Profile::Platform::Baseline" | |
| "Profile::Platform::Baseline::Linux" | |
| "Profile::Platform::Baseline::Linux::Firewall" |
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 'puppetdb' | |
| client = PuppetDB::Client.new({:server => 'http://localhost:8080'}) | |
| response = client.request( '', 'reports[certname,logs]{ latest_report? = true and facts { name = "role" and value = "test" } }') | |
| response.data.each do |c| | |
| c["logs"]["data"].each do |l| | |
| printf "%-30s %s\n" % [ c["certname"].rstrip(), l["message"].split(/[\[,\]]/)[1] ] if l["message"].include?('Echo') | |
| end | |
| 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
| Facter.add(:libcheck) do | |
| require 'digest' | |
| require 'yaml' | |
| begin | |
| digests = YAML.load(File.open('/Users/ipcrm/adhoc/fim/digest.yaml')) | |
| rescue | |
| exists = false | |
| digests = {} | |
| 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
| $nameo = 'image001.jpg' | |
| $fetch_url = "http://example.server.com:8081/artifactory/test/${nameo}" | |
| $full_path = "/var/tmp/${nameo}" | |
| $auth_string = 'admin:AP9YvfPYaxXS1phVhRJij6CJmBH' | |
| $install_path = '/var/tmp' | |
| $md5 = 'a4e2e68667e459a729ff5bc4609d8ba4' | |
| file { "${full_path}.md5": | |
| ensure => present, | |
| content => "${md5} ${full_path}", |