cheftacular 2.2.1 → 2.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c20403e9a06c24107c229161f34ed5ae10eb2360
4
- data.tar.gz: e9edf5b27994a98c4dbbc5aa07eab3907d5303ab
3
+ metadata.gz: 29520ff1bae99c83bce312f6f5f582505776a007
4
+ data.tar.gz: 7f79d595110a8850083c5314671129d08709560b
5
5
  SHA512:
6
- metadata.gz: e1a81ce225e84ab00701c15cee3d7cc5c519134795b4b382f55e4e9a4c8a59183d934cecc85e8afdedd2e49dafc80e1913da1e480cf4631f2e67836724001877
7
- data.tar.gz: 294dda1dc967aca367b832dcee99e6a2b5dac916b4ae877af379727ad9f71c3f5f7ad649701c60a6a075eb7b5d62519895f7f3ac2de9c61f774660e9d54cdc2e
6
+ metadata.gz: a52cf49de433628aab008679c6df07a7f42a9ca290f7895ee2e780a21db5481be3cefc09c9887981b9b4c089c7a1e8b418fb5bfc123102cd81fa5965c77999ef
7
+ data.tar.gz: cb443b1cc185d8ce16f4987415b396f8eb14473f9d66615612cfea10daab85972c38b8ce43c4a59390ebbc5339be8f6e7ecc052db81d8af33e295fcdf0e39f1f
@@ -37,7 +37,7 @@ class Cheftacular
37
37
  rescue Ridley::Errors::HTTPRequestEntityTooLarge => e
38
38
  puts "WARNING! #{ e }! The logs from this run will not be saved on the chef server. Wiping the bag so future runs can be saved."
39
39
 
40
- item.attributes = {id: 'logs', description: "store logs for an environment"}
40
+ item.attributes = @config[env]['logs_bag_hash'].keep_if {|key,val| key == 'id'}
41
41
 
42
42
  item.save
43
43
 
@@ -25,7 +25,7 @@ class Cheftacular
25
25
 
26
26
  cloudflare_records_hash = fetch_cloudflare_records_as_hash target_domain
27
27
 
28
- puts('#'.ljust(4) + 'subdomain'.ljust(50) + 'type'.ljust(6) + 'ttl'.ljust(5) + 'mode'.ljust(20) + 'value') unless @options['quiet']
28
+ puts('#'.ljust(4) + 'subdomain'.ljust(50) + 'type'.ljust(6) + 'ttl'.ljust(5) + 'cloudflare_on ' + 'mode'.ljust(20) + 'value') unless @options['quiet']
29
29
 
30
30
  domain_count = 1
31
31
 
@@ -36,7 +36,12 @@ class Cheftacular
36
36
  record_hash['activate_cloudflare'] = @config[@options['env']]['config_bag_hash'][@options['sub_env']]['cloudflare_activated_domains'].include?(record_hash['name'])
37
37
  end
38
38
 
39
- print(domain_count.to_s.ljust(4, '_') + record_hash['name'].ljust(50, '_') + record_hash['type'].ljust(6, '_') + record_hash['ttl'].to_s.ljust(5, '_'))
39
+ print(domain_count.to_s.ljust(4, '_') +
40
+ record_hash['name'].ljust(50, '_') +
41
+ record_hash['type'].ljust(6, '_') +
42
+ record_hash['ttl'].to_s.ljust(5, '_') +
43
+ record_hash['activate_cloudflare'].to_s.ljust(14, '_')
44
+ )
40
45
 
41
46
  if cloudflare_records_hash.has_key?("#{ record_hash['name'] }-#{ record_hash['type'] }") && ( !cloudflare_records_hash["#{ record_hash['name'] }-#{ record_hash['type'] }"].empty? ||
42
47
  cloudflare_record_does_include_value?(cloudflare_records_hash["#{ record_hash['name'] }-#{ record_hash['type'] }"], record_hash['value']) )
@@ -57,7 +62,7 @@ class Cheftacular
57
62
  record_hash['SRV_weight'],
58
63
  record_hash['SRV_port'],
59
64
  record_hash['SRV_target'],
60
- (record_hash['activate_cloudflare'] ? '1' : '0') #service_mode
65
+ (record_hash['activate_cloudflare'] ? 1 : 0) #service_mode
61
66
  )
62
67
 
63
68
  print 'create'.ljust(20, '_')
@@ -72,7 +77,8 @@ class Cheftacular
72
77
  end
73
78
 
74
79
  def create_dns_record_for_domain_from_address_hash domain, address_hash, *args
75
- domain_obj = PublicSuffix.parse domain
80
+ domain_obj = PublicSuffix.parse("#{ address_hash['name'] }.#{ domain }") if args.empty?
81
+ domain_obj ||= PublicSuffix.parse domain
76
82
 
77
83
  if args.include?('specific_domain_mode')
78
84
  puts("running cloud domain create_record:#{ domain_obj.domain }:#{ domain_obj.trd }:#{ address_hash['public'] }") if @options['verbose']
@@ -121,7 +127,9 @@ class Cheftacular
121
127
  'ttl' => 300
122
128
  }
123
129
 
124
- update_cloudflare_from_array_of_domain_hashes domain_obj.tld, target_domain_records
130
+ #ap target_domain_records
131
+
132
+ update_cloudflare_from_array_of_domain_hashes domain_obj.domain, target_domain_records
125
133
  end
126
134
  end
127
135
 
@@ -257,7 +265,7 @@ class Cheftacular
257
265
  else
258
266
  print 'edit'.ljust(20, '_')
259
267
 
260
- @config['cloudflare'].rec_edit(target_domain, record_hash['type'], possible_matches[0]['rec_id'], record_hash['name'], record_hash['value'], record_hash['ttl'])
268
+ @config['cloudflare'].rec_edit(target_domain, record_hash['type'], possible_matches[0]['rec_id'], record_hash['name'], record_hash['value'], record_hash['ttl'], record_hash['activate_cloudflare'])
261
269
  end
262
270
  end
263
271
 
@@ -296,7 +296,7 @@ class Cheftacular
296
296
 
297
297
  @config['ridley'] = Ridley.new(
298
298
  server_url: @config['cheftacular']['chef_server_url'],
299
- client_name: (@config['helper'].running_on_chef_node? ? @config['parser'].parse_node_name_from_client_file : @config['cheftacular']['cheftacular_chef_user']),
299
+ client_name: (@config['helper'].running_on_chef_node? ? @config['helper'].parse_node_name_from_client_file : @config['cheftacular']['cheftacular_chef_user']),
300
300
  client_key: File.expand_path("#{ @config['locs']['chef'] }/#{ @config['helper'].running_on_chef_node? ? 'client' : @config['cheftacular']['cheftacular_chef_user'] }.pem"),
301
301
  encrypted_data_bag_secret: @config['data_bag_secret'],
302
302
  ssl: { verify: @config['cheftacular']['ssl_verify'] == 'true' }
@@ -2,7 +2,7 @@ class Cheftacular
2
2
  class StatelessActionDocumentation
3
3
  def get_shorewall_allowed_connections
4
4
  @config['documentation']['stateless_action'] << [
5
- "`cft get_shorewall_allowed_connections` command will query a single server and return all of its ACCEPT connections " +
5
+ "`[NYI]cft get_shorewall_allowed_connections` command will query a single server and return all of its ACCEPT connections " +
6
6
  "from shorewall in it's syslog and return the results in a CSV format. Useful for tracking IP activity.",
7
7
 
8
8
  [
@@ -14,12 +14,8 @@ class Cheftacular
14
14
 
15
15
  class StatelessAction
16
16
  def get_shorewall_allowed_connections
17
+ raise "Not yet implemented"
17
18
  #TODO find and load syslog files from nodes!
18
- log_data << File.read(File.expand_path("#{ @locs['chef-log'] }/marketing_site_syslog_2.txt"))
19
- log_data << File.read(File.expand_path("#{ @locs['chef-log'] }/marketing_site_syslog_1.txt"))
20
- log_data << File.read(File.expand_path("#{ @locs['chef-log'] }/marketing_site_syslog.txt"))
21
-
22
- exit
23
19
 
24
20
  addresses = {}
25
21
 
@@ -51,7 +51,7 @@ class Cheftacular
51
51
  out << "#{ serv_name }:"
52
52
 
53
53
  output.join("\n").split("\n").each do |line|
54
- out << " #{ line }"
54
+ out << " #{ line }\n"
55
55
  end
56
56
 
57
57
  out << "\n"
@@ -70,6 +70,21 @@ module SSHKit
70
70
 
71
71
  psql_commands = [
72
72
  "select client_addr, state, sent_location, write_location, flush_location, replay_location, sync_priority from pg_stat_replication;",
73
+ %{
74
+ SELECT
75
+ client_addr,
76
+ sent_offset - (
77
+ replay_offset - (sent_xlog - replay_xlog) * 255 * 16 ^ 6 ) AS byte_lag
78
+ FROM (
79
+ SELECT
80
+ client_addr,
81
+ ('x' || lpad(split_part(sent_location, '/', 1), 8, '0'))::bit(32)::bigint AS sent_xlog,
82
+ ('x' || lpad(split_part(replay_location, '/', 1), 8, '0'))::bit(32)::bigint AS replay_xlog,
83
+ ('x' || lpad(split_part(sent_location, '/', 2), 8, '0'))::bit(32)::bigint AS sent_offset,
84
+ ('x' || lpad(split_part(replay_location, '/', 2), 8, '0'))::bit(32)::bigint AS replay_offset
85
+ FROM pg_stat_replication
86
+ ) AS s;
87
+ } #http://www.dansketcher.com/2013/01/27/monitoring-postgresql-streaming-replication/
73
88
  ]
74
89
 
75
90
  psql_commands.each do |cmnd|
@@ -2,7 +2,7 @@ class Cheftacular
2
2
  class StatelessActionDocumentation
3
3
  def update_cloudflare_dns_from_cloud
4
4
  @config['documentation']['stateless_action'] << [
5
- "`cft update_cloudflare_dns_from_cloud` command will force a full dns update for cloudflare. ",
5
+ "`cft update_cloudflare_dns_from_cloud [skip_update_tld]` command will force a full dns update for cloudflare. ",
6
6
 
7
7
  [
8
8
  " 1. It will ensure all the subdomain entries are correct (based on the contents of the addresses data bag) " +
@@ -10,7 +10,10 @@ class Cheftacular
10
10
  "does exist and point it to the correct private address for an environment.",
11
11
 
12
12
  " 2. This command will also ensure any dns records on your cloud are also migrated over to cloudflare as well. " +
13
- "This also includes the reverse in the event you would like to turn off cloudflare."
13
+ "This also includes the reverse in the event you would like to turn off cloudflare.",
14
+
15
+ " 3. The argument `skip_update_tld` will stop the long process of checking and updating all the server domains " +
16
+ "_before_ cloudflare is updated. Only skip if you believe your domain info on your cloud is accurate."
14
17
  ]
15
18
  ]
16
19
  end
@@ -22,7 +25,7 @@ class Cheftacular
22
25
 
23
26
  target_domain = @config[@options['env']]['config_bag_hash'][@options['sub_env']]['tld']
24
27
 
25
- @config['stateless_action'].update_tld 'self'
28
+ @config['stateless_action'].update_tld 'self' unless ARGV[1] == 'skip_update_tld'
26
29
 
27
30
  target_domain_records = @config['stateless_action'].cloud('domain', "read:#{ target_domain }")["records_for_#{ target_domain }"]
28
31
 
@@ -51,7 +51,7 @@ class Cheftacular
51
51
 
52
52
  @config['DNS'].compile_address_hash_for_server_from_options("set_specific_domain_name:#{ specific_domain }")
53
53
 
54
- sleep 5 #prepare for next domain
54
+ sleep 1 #prepare for next domain
55
55
  end
56
56
 
57
57
  @config[@options['env']]['config_bag_hash'][@options['sub_env']]['tld'] = target_tld
@@ -1,5 +1,5 @@
1
1
  class Cheftacular
2
2
  #major_version.minor_version.bugfixes
3
- VERSION = "2.2.1"
3
+ VERSION = "2.2.2"
4
4
  RUBY_VERSION = "2.2.2"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cheftacular
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.1
4
+ version: 2.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Louis Alridge
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-05-08 00:00:00.000000000 Z
11
+ date: 2015-05-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: hashie
@@ -242,7 +242,6 @@ files:
242
242
  - lib/cheftacular/action.rb
243
243
  - lib/cheftacular/actions/check.rb
244
244
  - lib/cheftacular/actions/console.rb
245
- - lib/cheftacular/actions/database.rb
246
245
  - lib/cheftacular/actions/db_console.rb
247
246
  - lib/cheftacular/actions/deploy.rb
248
247
  - lib/cheftacular/actions/log.rb
@@ -306,7 +305,7 @@ files:
306
305
  - lib/cheftacular/stateless_actions/service.rb
307
306
  - lib/cheftacular/stateless_actions/slack.rb
308
307
  - lib/cheftacular/stateless_actions/test_env.rb
309
- - lib/cheftacular/stateless_actions/update_cloudflare.rb
308
+ - lib/cheftacular/stateless_actions/update_cloudflare_dns_from_cloud.rb
310
309
  - lib/cheftacular/stateless_actions/update_split_branches.rb
311
310
  - lib/cheftacular/stateless_actions/update_tld.rb
312
311
  - lib/cheftacular/stateless_actions/upload_nodes.rb
@@ -1,13 +0,0 @@
1
- class Cheftacular
2
- class ActionDocumentation
3
- def database
4
-
5
- end
6
- end
7
-
8
- class Action
9
- def database
10
- #TODO allow checking of postgres settings
11
- end
12
- end
13
- end