puppetfactory 0.5.0 → 0.5.1

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: c914e44caa0a8d8068dc1dde6458e1587a4e9a21
4
- data.tar.gz: 0277babbde8fd654b881e33ec3db1dd2a8b5d7b5
3
+ metadata.gz: ceb3c177e16f42c3355f8b55007907ab79f5e3f1
4
+ data.tar.gz: 2b5e48325f1708c176684b63c03092534708198e
5
5
  SHA512:
6
- metadata.gz: d0aca7da02276544f5225eb03982ba6ca36dfa1dc6e9b7b260f38db7ee5174fdd9e745ce5abfa171ae22fe476b25c2d53ede98cbf31aa9a0270f67b0d918b288
7
- data.tar.gz: 5a917e68a33b5eb846483ab4cb419bc4ae4fab9cd708c89640308c614979837aebf5c10d5c9dd175260a92c6a018d1526b54933b8485c37f2c5352f0b25eb81d
6
+ metadata.gz: 03da88692da76df631a8e1a3bb3118dbf87ecc96e555886aae85f584b0c98166c9198c185c879eed12d920f531c1605d986e24dc738fe98fea29a144574312c2
7
+ data.tar.gz: 6fcc7a8a4516ceef4fc01758c263ca2136a54bdf14549a721fbea913242c1ba12bcbdb3172d79e0d9b2511c6922951cd8e5cc162678106e14b8d40b45753686d
@@ -38,37 +38,40 @@ class Puppetfactory::Plugins::CodeManager < Puppetfactory::Plugins
38
38
  begin
39
39
  environment = "#{@environments}/#{Puppetfactory::Helpers.environment_name(username)}"
40
40
  FileUtils.mkdir_p environment
41
- FileUtils.chown('pe-puppet', 'pe-puppet', environment)
41
+ FileUtils.chown(username, 'pe-puppet', environment)
42
42
  FileUtils.chmod(0750, environment)
43
43
 
44
- File.open(@sources) do |file|
45
- # make sure we don't have any concurrency issues
46
- file.flock(File::LOCK_EX)
47
-
48
- # We need to duplicate the sources list in the MEEP config for recovery options
49
- # I'd like to add it to code-manager.conf too and avoid the delay of running
50
- # puppet, but that's a race condition that we cannot accept.
51
- File.open(@meep) do |anotherfile|
52
- anotherfile.flock(File::LOCK_EX)
53
-
54
- source = {
55
- 'remote' => sprintf(@pattern, username),
56
- 'prefix' => (@repomodel == :peruser),
57
- }
58
-
59
- sources = YAML.load_file(@sources)
60
- meep = Hocon::Parser::ConfigDocumentFactory.parse_file(@meep)
61
-
62
- sources['puppet_enterprise::master::code_manager::sources'][username] = source
63
- meep = meep.set_config_value(
64
- "\"puppet_enterprise::master::code_manager::sources\".#{username}",
65
- Hocon::ConfigValueFactory.from_any_ref(source)
66
- )
67
-
68
- # Ruby 1.8.7, why don't you just go away now
69
- File.open(@sources, 'w') { |f| f.write(sources.to_yaml) }
70
- File.open(@meep, 'w') { |f| f.write(meep.render) }
71
- $logger.info "Created Code Manager source for #{username}"
44
+ # We don't need to add sources unless we're using a repo per student.
45
+ if @repomodel == :peruser
46
+ File.open(@sources) do |file|
47
+ # make sure we don't have any concurrency issues
48
+ file.flock(File::LOCK_EX)
49
+
50
+ # We need to duplicate the sources list in the MEEP config for recovery options
51
+ # I'd like to add it to code-manager.conf too and avoid the delay of running
52
+ # puppet, but that's a race condition that we cannot accept.
53
+ File.open(@meep) do |anotherfile|
54
+ anotherfile.flock(File::LOCK_EX)
55
+
56
+ source = {
57
+ 'remote' => sprintf(@pattern, username),
58
+ 'prefix' => (@repomodel == :peruser),
59
+ }
60
+
61
+ sources = YAML.load_file(@sources)
62
+ meep = Hocon::Parser::ConfigDocumentFactory.parse_file(@meep)
63
+
64
+ sources['puppet_enterprise::master::code_manager::sources'][username] = source
65
+ meep = meep.set_config_value(
66
+ "\"puppet_enterprise::master::code_manager::sources\".#{username}",
67
+ Hocon::ConfigValueFactory.from_any_ref(source)
68
+ )
69
+
70
+ # Ruby 1.8.7, why don't you just go away now
71
+ File.open(@sources, 'w') { |f| f.write(sources.to_yaml) }
72
+ File.open(@meep, 'w') { |f| f.write(meep.render) }
73
+ $logger.info "Created Code Manager source for #{username}"
74
+ end
72
75
  end
73
76
  end
74
77
  rescue => e
@@ -22,28 +22,29 @@ class Puppetfactory::Plugins::R10k < Puppetfactory::Plugins
22
22
  end
23
23
 
24
24
  def create(username, password)
25
- return unless @repomodel == :peruser
26
-
27
25
  begin
28
26
  environment = "#{@environments}/#{Puppetfactory::Helpers.environment_name(username)}"
29
27
  FileUtils.mkdir_p environment
30
28
  FileUtils.chown_R(username, 'pe-puppet', environment)
31
29
  FileUtils.chmod(0750, environment)
32
30
 
33
- File.open(@r10k_config) do |file|
34
- # make sure we don't have any concurrency issues
35
- file.flock(File::LOCK_EX)
36
-
37
- r10k = YAML.load_file(@r10k_config)
38
- r10k['sources'][username] = {
39
- 'remote' => sprintf(@pattern, username),
40
- 'basedir' => @environments,
41
- 'prefix' => true,
42
- }
43
-
44
- # Ruby 1.8.7, why don't you just go away now
45
- File.open(@r10k_config, 'w') { |f| f.write(r10k.to_yaml) }
46
- $logger.info "Created r10k source for #{username}"
31
+ # We don't need to add sources unless we're using a repo per student.
32
+ if @repomodel == :peruser
33
+ File.open(@r10k_config) do |file|
34
+ # make sure we don't have any concurrency issues
35
+ file.flock(File::LOCK_EX)
36
+
37
+ r10k = YAML.load_file(@r10k_config)
38
+ r10k['sources'][username] = {
39
+ 'remote' => sprintf(@pattern, username),
40
+ 'basedir' => @environments,
41
+ 'prefix' => true,
42
+ }
43
+
44
+ # Ruby 1.8.7, why don't you just go away now
45
+ File.open(@r10k_config, 'w') { |f| f.write(r10k.to_yaml) }
46
+ $logger.info "Created r10k source for #{username}"
47
+ end
47
48
  end
48
49
  rescue => e
49
50
  $logger.error "Cannot create r10k source for #{username}"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: puppetfactory
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ben Ford
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2016-09-23 00:00:00.000000000 Z
12
+ date: 2016-09-26 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: sinatra
@@ -136,18 +136,16 @@ executables:
136
136
  extensions: []
137
137
  extra_rdoc_files: []
138
138
  files:
139
- - LICENSE
140
139
  - README.md
140
+ - LICENSE
141
141
  - bin/pfsh
142
142
  - bin/puppetfactory
143
- - lib/puppetfactory.rb
144
143
  - lib/puppetfactory/cli.rb
145
144
  - lib/puppetfactory/dashboard/rake_tasks.rb
146
145
  - lib/puppetfactory/dashboard/serverspec_helper.rb
147
146
  - lib/puppetfactory/dashboard/spec_helper.rb
148
147
  - lib/puppetfactory/helpers.rb
149
148
  - lib/puppetfactory/monkeypatches.rb
150
- - lib/puppetfactory/plugins.rb
151
149
  - lib/puppetfactory/plugins/certificates.rb
152
150
  - lib/puppetfactory/plugins/classification.rb
153
151
  - lib/puppetfactory/plugins/code_manager.rb
@@ -164,6 +162,14 @@ files:
164
162
  - lib/puppetfactory/plugins/r10k.rb
165
163
  - lib/puppetfactory/plugins/shell_user.rb
166
164
  - lib/puppetfactory/plugins/user_environment.rb
165
+ - lib/puppetfactory/plugins.rb
166
+ - lib/puppetfactory.rb
167
+ - views/dashboard.erb
168
+ - views/home.erb
169
+ - views/index.erb
170
+ - views/logs.erb
171
+ - views/shell.erb
172
+ - views/users.erb
167
173
  - public/css/images/ui-bg_diagonals-thick_18_b81900_40x40.png
168
174
  - public/css/images/ui-bg_diagonals-thick_20_666666_40x40.png
169
175
  - public/css/images/ui-bg_flat_10_000000_40x100.png
@@ -233,12 +239,6 @@ files:
233
239
  - templates/init_scripts.erb
234
240
  - templates/puppet.conf.erb
235
241
  - templates/site.pp.erb
236
- - views/dashboard.erb
237
- - views/home.erb
238
- - views/index.erb
239
- - views/logs.erb
240
- - views/shell.erb
241
- - views/users.erb
242
242
  homepage: https://github.com/puppetlabs/puppetfactory
243
243
  licenses:
244
244
  - Apache-2.0
@@ -259,7 +259,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
259
259
  version: '0'
260
260
  requirements: []
261
261
  rubyforge_project:
262
- rubygems_version: 2.4.5.1
262
+ rubygems_version: 2.0.14.1
263
263
  signing_key:
264
264
  specification_version: 4
265
265
  summary: Stands up a graphical classroom manager with containerized puppet agents.