Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
🤘

Christian Schulze-Wiehenbrauk Ntr0

💭
🤘
View GitHub Profile
View keybase.md

Keybase proof

I hereby claim:

  • I am ntr0 on github.
  • I am ntr0 (https://keybase.io/ntr0) on keybase.
  • I have a public key ASDBinYTQCl73M4GJfB9xmZyj4i3LhQayd6oRiIWh_h_dQo

To claim this, I am signing this object:

@Ntr0
Ntr0 / linux_bridge.py
Created Dec 8, 2017 — forked from upa/LICENSE
Ansible Module for Linux Bridge and VLAN
View linux_bridge.py
#!/usr/bin/env python
#-*- coding: utf-8 -*-
DOCUMENTATION = '''
---
module: linux_bridge
short_description: Manage Linux bridges
requirements: [ brctl ]
description:
- Manage Linux bridges
View domains_controller_test.rb
# test/controllers/api/v2/domains_controller_test.rb
# http://projects.theforeman.org/issues/19707
test "should get domains for searched location only" do
hg = FactoryGirl.create(:hostgroup, :id => domains(:yourdomain).id, :location_ids => [taxonomies(:location2).id])
taxonomies(:location2).domain_ids = [domains(:unuseddomain).id]
get :index, {:search => "location_id=#{taxonomies(:location2).id}" }
assert_response :success
assert_equal taxonomies(:location2).domains.length, assigns(:domains).length
assert_equal assigns(:domains), taxonomies(:location2).domains
end
View gist:922a52b11476cde4ed256069c06684a1
-- The main select just gets _all_ records which have a relation to taxonomies via taxable_taxonomies
select d.id, d.name, tt.taxable_type, tt.taxonomy_id from domains as d left outer join taxable_taxonomies as tt on tt.taxable_id = d.id and tt.taxable_type = 'Domain' left outer join taxonomies as t on t.id = tt.taxonomy_id and t.type = 'Location';
id | name | taxable_type | taxonomy_id
----+--------------------+--------------+-------------
2 | four.example.com | Domain | 1
1 | three.example.com | Domain | 1
11 | one.example.com | Domain | 13
11 | one.example.com | Domain | 12
12 | two.example.com | Domain | 14