Skip to content

Commit 14651e9

Browse files
committed
Ran rubocop with autocorrect on tasks and functions
1 parent 0ba9622 commit 14651e9

File tree

9 files changed

+28
-12
lines changed

9 files changed

+28
-12
lines changed

examples/ruby_task.rb

+2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
#!/opt/puppetlabs/puppet/bin/ruby
2+
# frozen_string_literal: true
3+
24
#
35
# rubocop:disable Style/GlobalVars
46
require 'json'

lib/puppet/functions/peadm/file_content_upload.rb

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
require 'tempfile'
24

35
Puppet::Functions.create_function(:'peadm::file_content_upload') do

lib/puppet/functions/peadm/node_manager_yaml_location.rb

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
Puppet::Functions.create_function(:'peadm::node_manager_yaml_location') do
24
dispatch :nm_yaml_location do
35
end

spec/spec_helper_local.rb

+10-8
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,15 @@
2020
# locate the bolt gem dir and create fixtures for each of the bolt modules.
2121

2222
spec = Gem::Specification.latest_specs.find { |s| s.name.eql?('bolt') }
23-
bolt_modules = File.join(spec.full_gem_path, 'bolt-modules')
24-
Dir.glob(File.join(bolt_modules, '*')).each do |dir|
25-
mod_name = File.basename(dir)
26-
mod_path = File.expand_path(File.join(__dir__, 'fixtures', 'modules', mod_name))
27-
FileUtils.ln_sf(dir, mod_path) unless File.exist?(mod_path)
28-
end
23+
if spec
24+
bolt_modules = File.join(spec.full_gem_path, 'bolt-modules')
25+
Dir.glob(File.join(bolt_modules, '*')).each do |dir|
26+
mod_name = File.basename(dir)
27+
mod_path = File.expand_path(File.join(__dir__, 'fixtures', 'modules', mod_name))
28+
FileUtils.ln_sf(dir, mod_path) unless File.exist?(mod_path)
29+
end
2930

30-
RSpec.configure do |c|
31-
c.basemodulepath = bolt_modules
31+
RSpec.configure do |c|
32+
c.basemodulepath = bolt_modules
33+
end
3234
end

tasks/rbac_token.rb

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
#!/opt/puppetlabs/puppet/bin/ruby
2+
# frozen_string_literal: true
3+
24
#
35
# rubocop:disable Style/GlobalVars
46
require 'net/https'
@@ -16,7 +18,7 @@
1618
'login' => 'admin',
1719
'password' => $params['password'],
1820
'lifetime' => '1y',
19-
'label' => 'provision-time token',
21+
'label' => 'provision-time token'
2022
}.to_json
2123

2224
http = Net::HTTP.new(uri.host, uri.port)

tasks/read_file.rb

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#!/opt/puppetlabs/puppet/bin/ruby
2+
# frozen_string_literal: true
23

34
require 'json'
45

@@ -8,11 +9,11 @@
89
rescue StandardError => err
910
result = {
1011
'content' => nil,
11-
'error' => err.message,
12+
'error' => err.message
1213
}
1314
else
1415
result = {
15-
'content' => content,
16+
'content' => content
1617
}
1718
ensure
1819
puts result.to_json

tasks/sign_csr.rb

+2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
#!/opt/puppetlabs/puppet/bin/ruby
2+
# frozen_string_literal: true
3+
24
#
35
require 'json'
46
require 'open3'

tasks/submit_csr.rb

+2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
#!/opt/puppetlabs/puppet/bin/ruby
2+
# frozen_string_literal: true
3+
24
#
35
require 'json'
46
require 'open3'

tasks/trusted_facts.rb

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#!/opt/puppetlabs/puppet/bin/ruby
2+
# frozen_string_literal: true
23

34
require 'openssl'
45
require 'puppet'
@@ -35,7 +36,7 @@
3536
result = {
3637
'certname' => certname,
3738
'dns-alt-names' => alt_names,
38-
'extensions' => extensions,
39+
'extensions' => extensions
3940
}
4041

4142
puts result.to_json

0 commit comments

Comments
 (0)