puppet-classroom-manager 0.0.2 → 0.0.3

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: d40f055cbde79805220831826bc1128772f84965
4
- data.tar.gz: 72d28900ce567fb1817a47a7a3457f901537e565
3
+ metadata.gz: af0e7af7ee77ab29d61058fa57eba4af51f44d2c
4
+ data.tar.gz: fb770cff71763c9288217fde895d8f9cc70ed641
5
5
  SHA512:
6
- metadata.gz: 605d3a23d1a59ca411f51edaa7891de4d261387381d2023581bde06e9cc5bde2a949d92c2cf521688fcd9c6cc32e48697468e76afd958cadfcdd081bc16b2073
7
- data.tar.gz: c50b0ffa83ba2a2033b7fdfce4b49f982eee19d624bcc4f9a47d8e2f24fcbfd1daa9ef2426b2fedd507d2597090829728f125aadbd876804ecd89b28c5b5d1c9
6
+ metadata.gz: 544f54aca8ad9b49f131c15d4491411656048de94b33b1e072ff64883b0f314d5fcd571164d73f95e760fc87b69b07ef0b8c52e8df8b7db965d89b30653a6403
7
+ data.tar.gz: 624df6da7f0eaea5877211766fd02c2b76d89805146525b8e4334daf30653d8686f417867e1192256115ec75d80528b81969d3067a4af5fb74b129441956e068
data/bin/classroom CHANGED
@@ -19,7 +19,7 @@ optparse = OptionParser.new { |opts|
19
19
  the delivery and facilities for resetting the VM for use across
20
20
  multiple deliveries. This is pre-installed on the classroom VM.
21
21
 
22
- Type courseware help for full usage instructions.
22
+ Type classroom help for full usage instructions.
23
23
 
24
24
  "
25
25
 
@@ -34,7 +34,7 @@ optparse = OptionParser.new { |opts|
34
34
  opts.separator('')
35
35
 
36
36
  opts.on("-v", "--version", "Print out the version") do
37
- require 'courseware/version'
37
+ require 'classroom/version'
38
38
  puts Courseware::VERSION
39
39
  exit
40
40
  end
data/lib/classroom.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  class Classroom
2
+ require 'classroom/page'
2
3
  require 'classroom/performance'
3
4
  require 'classroom/reset'
4
5
  require 'classroom/restart'
@@ -5,7 +5,8 @@ class Classroom
5
5
 
6
6
  begin
7
7
  config = JSON.parse(File.read('/opt/pltraining/etc/classroom.json'))
8
- pd_key = File.read('/opt/pltraining/etc/pagerduty.key')
8
+ pd_key = File.read('/opt/pltraining/etc/pagerduty.key').strip
9
+ raise 'Missing PagerDuty key' if pd_key.empty?
9
10
  rescue => e
10
11
  puts "Cannot load configuration"
11
12
  puts e.message
@@ -18,24 +19,30 @@ class Classroom
18
19
  puts "https://github.com/puppetlabs/courseware/blob/master/TroubleshootingGuide.md"
19
20
  puts
20
21
  if confirm?("Have you done everything in the troubleshooting guide?") then
21
- puts "Sending page. Make sure you've posted about the issue in HipChat."
22
- config = load_metadata
23
- page_message = "Instructor: #{config['name']}\n" +
24
- "Email: #{config['email']}\n" +
25
- "Course: #{config['course']}\n" +
22
+ print 'Describe the problem in a short sentence: '
23
+ description = STDIN.gets.strip
24
+
25
+ print 'Enter the email or phone number where you can be reached: '
26
+ contact = STDIN.gets.strip
27
+
28
+ page_message = "#{description}\n" +
29
+ "Contact: #{contact}\n" +
30
+ "Course: #{config['course']} #{config['version']}\n" +
26
31
  "ID: #{config['event_id']}"
27
32
  page_data = {
28
33
  "service_key" => pd_key,
29
34
  "event_type" => "trigger",
30
35
  "description" => page_message
31
36
  }
32
- response = RestClient.post(
37
+
38
+ puts "Sending page. Make sure you've posted about the issue in HipChat."
39
+ response = JSON.parse(RestClient.post(
33
40
  "https://events.pagerduty.com/generic/2010-04-15/create_event.json",
34
41
  page_data.to_json,
35
42
  :content_type => :json,
36
43
  :accept => :json
37
- )
38
- puts response
44
+ ))
45
+ puts response unless response['status'] == 'success'
39
46
  end
40
47
  end
41
48
  end
@@ -10,7 +10,7 @@ class Classroom
10
10
  master = `puppet agent --configprint server`.strip
11
11
  classifier = "http://#{master}:4433/classifier-api"
12
12
  known_groups = [ 'All Nodes', 'Agent-specified environment', 'Production environment', /PE / ]
13
- known_users = [ 'admin"=', 'api_user', 'deployer' ]
13
+ known_users = [ 'admin', 'api_user', 'deployer' ]
14
14
  auth_info = {
15
15
  'ca_certificate_path' => `puppet master --configprint localcacert`.strip,
16
16
  'certificate_path' => `puppet master --configprint hostcert`.strip,
@@ -37,9 +37,9 @@ class Classroom
37
37
  FileUtils.rm(filename)
38
38
 
39
39
  rescue LoadError, StandardError => e
40
- LOGGER.warn "S3 upload failed. No network?"
41
- LOGGER.warn e.message
42
- LOGGER.debug e.backtrace
40
+ $logger.warn "S3 upload failed. No network?"
41
+ $logger.warn e.message
42
+ $logger.debug e.backtrace
43
43
  end
44
44
 
45
45
  # clean up for next delivery
@@ -17,18 +17,18 @@ class Classroom
17
17
 
18
18
  print "Cleaning any stray .git directories in: #{codedir}..."
19
19
  sleep 1
20
- system("find #{codedir} -name .git -type d -print -exec rm -rf {} \\;")
20
+ system("find #{codedir} -name .git -type d -print -exec rm -rf {} +")
21
21
  check_success
22
22
 
23
23
  print "Validating permissions on: #{codedir}..."
24
24
  sleep 1
25
- system("find #{codedir} '!' -user pe-puppet -print -exec chown pe-puppet:pe-puppet {} \\;")
25
+ system("find #{codedir} '!' -user pe-puppet -print -exec chown pe-puppet:pe-puppet {} +")
26
26
  check_success
27
27
 
28
28
  if codedir != staging
29
29
  puts "Validating permissions on: #{staging}..."
30
30
  sleep 1
31
- system("find #{staging} '!' -user pe-puppet -print -exec chown pe-puppet:pe-puppet {} \\;")
31
+ system("find #{staging} '!' -user pe-puppet -print -exec chown pe-puppet:pe-puppet {} +")
32
32
  check_success
33
33
  end
34
34
 
@@ -47,7 +47,7 @@ class Classroom
47
47
  end
48
48
 
49
49
  print "Checking Forge connection..."
50
- if system("ping -c1 -W2 forge.puppet.com >/dev/null 2>&1")
50
+ if system("curl -s https://forge.puppet.com >/dev/null 2>&1")
51
51
  if legacy
52
52
  puts "Ensuring the latest version of pltraining/classroom in #{staging}..."
53
53
  system("puppet module upgrade pltraining/classroom --modulepath #{staging}")
@@ -1,3 +1,3 @@
1
1
  class Classroom
2
- VERSION = '0.0.2'
2
+ VERSION = '0.0.3'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: puppet-classroom-manager
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ben Ford
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-08-22 00:00:00.000000000 Z
11
+ date: 2018-02-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aws-sdk
@@ -107,9 +107,10 @@ executables:
107
107
  extensions: []
108
108
  extra_rdoc_files: []
109
109
  files:
110
- - README.md
111
110
  - LICENSE
111
+ - README.md
112
112
  - bin/classroom
113
+ - lib/classroom.rb
113
114
  - lib/classroom/help.rb
114
115
  - lib/classroom/page.rb
115
116
  - lib/classroom/performance.rb
@@ -120,7 +121,6 @@ files:
120
121
  - lib/classroom/troubleshoot.rb
121
122
  - lib/classroom/validate.rb
122
123
  - lib/classroom/version.rb
123
- - lib/classroom.rb
124
124
  homepage: http://github.com/puppetlabs/puppet-classroom-manager
125
125
  licenses:
126
126
  - Apache-2.0
@@ -141,7 +141,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
141
141
  version: '0'
142
142
  requirements: []
143
143
  rubyforge_project:
144
- rubygems_version: 2.0.14.1
144
+ rubygems_version: 2.5.2
145
145
  signing_key:
146
146
  specification_version: 4
147
147
  summary: Manage Puppet classroom VMs and updating courseware.