Skip to content

Instantly share code, notes, and snippets.

View kannan4k's full-sized avatar

Kannan Ponnusamy kannan4k

View GitHub Profile
"call_ep": {
"fwdport": 33082,
"fwdwebport": 38082,
"keyname": "Google Moscow",
"rescue": true
},
@kannan4k
kannan4k / backup_health.py
Last active August 29, 2015 14:19
Backup health check
#!/usr/bin/env python
import os
import sys
import datetime
#rsync config path
rsync_secrets = "/etc/rsyncd.lg-secrets"
backup_root = "/backup"
# Exit statuses recognized by Nagios
@kannan4k
kannan4k / gist:c686969d39e97e9bf85b
Created April 21, 2015 11:17
apt-update problem when i ran pull-requests job
==> portal-pull-requests: [2015-04-21T10:47:14+00:00] WARN: Cloning resource attributes for execute[apt-get-update-periodic] from prior resource (CHEF-3694)
==> portal-pull-requests: [2015-04-21T10:47:14+00:00] WARN: Previous execute[apt-get-update-periodic]: /var/chef/cache/cookbooks/apt/recipes/default.rb:52:in `from_file'
==> portal-pull-requests: [2015-04-21T10:47:14+00:00] WARN: Current execute[apt-get-update-periodic]: /var/chef/cache/cookbooks/apt/recipes/nodejs.rb:12:in `from_file'
==> portal-pull-requests: [2015-04-21T10:47:14+00:00] WARN: Cloning resource attributes for package[grub-pc] from prior resource (CHEF-3694)
==> portal-pull-requests: [2015-04-21T10:47:14+00:00] WARN: Previous package[grub-pc]: /var/chef/cache/cookbooks/lg_tftproot/recipes/grub.rb:14:in `from_file'
==> portal-pull-requests: [2015-04-21T10:47:14+00:00] WARN: Current package[grub-pc]: /var/chef/cache/cookbooks/lg_grub/recipes/default.rb:18:in `from_file'
==> portal-pull-requests: [2015-04-21T10:47:14+00:00] INFO: Processing
4096 59:10:22:6f:0e:c5:ba:12:0e:34:f5:e3:7c:4b:7b:18 /Users/kannan/.ssh/id_rsa (RSA)
Converting from raw image file="../files/ipxe.usb" to file="../files/ipxe_portal-pull-requests-nuc.vmdk"...
Creating dynamic image with size 409600 bytes (1MB)...
Timed out while waiting for the machine to boot. This means that
Vagrant was unable to communicate with the guest machine within
the configured ("config.vm.boot_timeout" value) time period.
If you look above, you should be able to see the error(s) that
Vagrant had when attempting to connect to the machine. These errors
are usually good hints as to what may be wrong.
@kannan4k
kannan4k / terminal_output
Created April 22, 2015 03:19
Portal Pull Requests Output
Last login: Wed Apr 22 01:27:32 on ttys002
kannan@Kannans-MacBook-Pro: ~/ep/lg_chef
$ bash test/scripts/run_tests.sh
==> portal-pull-requests-kiosk: VM not created. Moving on...
==> portal-pull-requests-display: VM not created. Moving on...
==> portal-pull-requests-nuc: VM not created. Moving on...
==> portal-pull-requests: VM not created. Moving on...
Not managing knife client because => chef_zero
All ssh keys presented below
4096 59:10:22:6f:0e:c5:ba:12:0e:34:f5:e3:7c:4b:7b:18 /Users/kannan/.ssh/id_rsa (RSA)
@kannan4k
kannan4k / check_multiple.py
Last active August 29, 2015 14:20
check_multiple_nagios_commands
#! /usr/bin/env python
import sys
import getopt
import optparse
import commands
import shlex
def returnStatus(statusInfo,checkMode):
statusResult = None
@kannan4k
kannan4k / sample
Created June 18, 2015 17:14
sample
sample
class TSheets::Model
def self.from_raw(hash, cache, supplemental = {})
instance = hash.inject self.new(cache) do |o, p|
k, v = p
casted = cast_raw(v, k, cache)
has_key = o.attributes.keys.include? k
if !has_key
o.instance_variable_set "@#{k}".to_sym, casted
o.define_singleton_method k do
o.instance_variable_get "@#{k}".to_sym
@kannan4k
kannan4k / api.rb
Last active August 29, 2015 14:25
def load_next_batch
response = self.bridge.next_batch(self.url, self.name, self.options, self.is_singleton)
puts "Self.model"
puts self.model
batch = response[:items]
self.has_more = !self.is_singleton && response[:has_more]
if self.is_singleton
self.loaded = [ self.model.from_raw(batch, self.cache, response[:supplemental] || {}) ]
else
self.loaded += batch.map { |o| self.model.from_raw(o, self.cache, response[:supplemental] || {}) }
import logger
class Results(object):
def __init__(self, url, options, model, bridge, cache, is_singleton = False, mode = "list")
self.url = url
self.options = options
self.model = model
self.name = "users"
self.index = -1
self.loaded = []