Skip to content

Commit

Permalink
Fix linting
Browse files Browse the repository at this point in the history
  • Loading branch information
daaang committed Nov 5, 2024
1 parent 39bda2f commit 83ac37b
Show file tree
Hide file tree
Showing 172 changed files with 1,866 additions and 1,758 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@ jobs:
- name: Run tests
run: |
docker compose --file docker-compose.test.yml build
docker compose --file docker-compose.test.yml run lint
docker compose --file docker-compose.test.yml run specs
# docker compose --file docker-compose.test.yml run lint
34 changes: 34 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -118,3 +118,37 @@ RSpec/NamedSubject:
Enabled: false # would love to enable, but rspec-puppet plays by its own rules
Style/NumericLiterals:
Enabled: false # all our long numbers are ports, and 8080 should not look like 8_080
Lint/DuplicateBranch: # (new in 1.3)
Enabled: false
Lint/DuplicateRegexpCharacterClassElement: # (new in 1.1)
Enabled: false
Lint/EmptyBlock: # (new in 1.1)
Enabled: false
Lint/EmptyClass: # (new in 1.3)
Enabled: false
Lint/NoReturnInBeginEndBlocks: # (new in 1.2)
Enabled: false
Lint/ToEnumArguments: # (new in 1.1)
Enabled: false
Lint/UnexpectedBlockArity: # (new in 1.5)
Enabled: false
Lint/UnmodifiedReduceAccumulator: # (new in 1.1)
Enabled: false
Style/ArgumentsForwarding: # (new in 1.1)
Enabled: false
Style/CollectionCompact: # (new in 1.2)
Enabled: false
Style/DocumentDynamicEvalDefinition: # (new in 1.1)
Enabled: false
Style/NegatedIfElseCondition: # (new in 1.2)
Enabled: false
Style/NilLambda: # (new in 1.3)
Enabled: false
Style/RedundantArgument: # (new in 1.4)
Enabled: false
Style/SwapValues: # (new in 1.1)
Enabled: false
RSpec/MultipleMemoizedHelpers:
Max: 15
Naming/VariableNumber:
EnforcedStyle: snake_case
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ group :development do
gem "puppet-module-posix-default-r#{minor_version}", require: false, platforms: [:ruby]
gem "puppet-module-posix-dev-r#{minor_version}", require: false, platforms: [:ruby]
gem "rspec-puppet-utils"
gem "rubocop-rake"
gem "faker"
gem "parallel_tests"
gem "librarian-puppet"
Expand Down
3 changes: 3 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,8 @@ GEM
rubocop-performance (1.9.1)
rubocop (>= 0.90.0, < 2.0)
rubocop-ast (>= 0.4.0)
rubocop-rake (0.6.0)
rubocop (~> 1.0)
rubocop-rspec (2.0.1)
rubocop (~> 1.0)
rubocop-ast (>= 1.1.0)
Expand Down Expand Up @@ -301,6 +303,7 @@ DEPENDENCIES
puppet-strings
rake (>= 13.0.6)
rspec-puppet-utils
rubocop-rake
semantic_puppet
yard (>= 0.9.36)

Expand Down
2 changes: 1 addition & 1 deletion docker-compose.test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ services:
command:
- /bin/bash
- '-c'
- 'bundle exec rake rubocop && bundle exec rake syntax lint && bundle exec rake metadata_lint'
- 'bundle exec rubocop ''spec/{aliases,classes,defines,functions,hosts,integration,plans,tasks,type_aliases,types,unit}/**/*_spec.rb'' && bundle exec rake syntax lint && bundle exec rake metadata_lint'

librarian:
build: .
Expand Down
12 changes: 6 additions & 6 deletions manifests/local_storage_volume.pp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# BSD License. See LICENSE.txt for details.

# nebula::local_storage_volume
#
#
# Create a volume to use for kubernetes local storage on a worker node
##
# @param volume_name The name of the volume (conventionally the UUID of the PVC)
Expand All @@ -14,24 +14,24 @@
Integer $mib_capacity
) {

file { "/mnt/local-pvs/mounts/$volume_name":
file { "/mnt/local-pvs/mounts/${volume_name}":
ensure => 'directory'
}

exec { "make $volume_name disk file":
exec { "make ${volume_name} disk file":
command => "/bin/dd if=/dev/zero of=/mnt/local-pvs/disks/${volume_name} bs=1048576 count=${mib_capacity}",
creates => "/mnt/local-pvs/disks/${volume_name}"
}

exec { "make $volume_name a filesystem":
exec { "make ${volume_name} a filesystem":
command => "/sbin/mkfs.ext4 -m 0 /mnt/local-pvs/disks/${volume_name}",
unless => "/usr/bin/file /mnt/local-pvs/disks/${volume_name} | grep ext4"
unless => "/usr/bin/file /mnt/local-pvs/disks/${volume_name} | grep ext4"
}

mount { "/mnt/local-pvs/mounts/${volume_name}":
ensure => 'mounted',
device => "/mnt/local-pvs/disks/${volume_name}",
options => "loop,rw,usrquota,grpquota",
options => 'loop,rw,usrquota,grpquota',
fstype => 'ext4',
}
}
4 changes: 2 additions & 2 deletions manifests/log.pp
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
# }
#
define nebula::log (
String $service = $title,
Array[String] $files,
String $service = $title,
){
include nebula::profile::loki

Expand All @@ -25,6 +25,6 @@
mode => '0644',
require => Package['alloy'],
notify => Service['alloy'],
content => template("nebula/profile/loki/drop_in.alloy.erb"),
content => template('nebula/profile/loki/drop_in.alloy.erb'),
}
}
4 changes: 2 additions & 2 deletions manifests/profile/apache/auth_openidc.pp
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@

file { '/var/cache/apache2/mod_auth_openidc/oidc-sessions':
ensure => 'directory',
owner => "${::apache::user}",
group => "${::apache::group}",
owner => $::apache::user,
group => $::apache::group,
mode => '0700'
}

Expand Down
10 changes: 5 additions & 5 deletions manifests/profile/apache/authz_umichlib.pp
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,19 @@
#
# @param oracle_home The value for the $ORACLE_HOME environment variable.
#
# @param oracle_servers The names of servers (Hash) and their relevant
# @param oracle_servers The names of servers (Hash) and their relevant
# aliases (String Array). Note servers should be lowercase while aliases
# must be uppercase.
#
# e.g.
# e.g.
# myserver:
# - ORCL.MYSERVER1
# - ORCL.MYSERVER2
# - ORCL.MYSERVER2
#
# @param oracle_sid The SID for the oracle service. Oracle default is
# @param oracle_sid The SID for the oracle service. Oracle default is
# set as default here
#
# @param oracle_port The port for the oracle service. Oracle default is
# @param oracle_port The port for the oracle service. Oracle default is
# set as default here
#
# @example
Expand Down
4 changes: 2 additions & 2 deletions manifests/profile/apt.pp
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
# include nebula::profile::apt
class nebula::profile::apt (
String $mirror,
String $ubuntu_mirror = "http://us.archive.ubuntu.com/ubuntu",
String $puppet_repo,
Boolean $purge = true,
String $ubuntu_mirror = 'http://us.archive.ubuntu.com/ubuntu',
Optional[Hash] $local_repo = undef,
) {

Expand Down Expand Up @@ -141,7 +141,7 @@
location => $ubuntu_mirror,
repos => 'main restricted universe',
;
'main' : release => "${::lsbdistcodename}";
'main' : release => $::lsbdistcodename;
'updates' : release => "${::lsbdistcodename}-updates";
'backports': release => "${::lsbdistcodename}-backports";
'security' : release => "${::lsbdistcodename}-security";
Expand Down
4 changes: 2 additions & 2 deletions manifests/profile/apt/mono.pp
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
# default to buster if we're not on a supported release
# check here to see if list of supported releases updated:
# https://download.mono-project.com/repo/debian/index.html
if "${::lsbdistcodename}" in ['xenial', 'bionic', 'focal', 'jessie', 'stretch', 'buster'] {
$apt_release = "${::lsbdistcodename}"
if $::lsbdistcodename in ['xenial', 'bionic', 'focal', 'jessie', 'stretch', 'buster'] {
$apt_release = $::lsbdistcodename
} else {
warning("nebula::profile::apt::mono: defaulting to apt repo dist 'buster'")
# using buster because it's newer than focal
Expand Down
26 changes: 13 additions & 13 deletions manifests/profile/bolt.pp
Original file line number Diff line number Diff line change
Expand Up @@ -28,26 +28,26 @@
}
}

file { "/opt/bolt":
ensure => "directory",
owner => "git",
file { '/opt/bolt':
ensure => 'directory',
owner => 'git',
group => 100,
mode => "0755",
mode => '0755',
}

vcsrepo { "/opt/bolt":
provider => "git",
ensure => "latest",
source => "ssh://[email protected]/mlibrary/bolt.git",
user => "git",
vcsrepo { '/opt/bolt':
ensure => 'latest',
provider => 'git',
source => 'ssh://[email protected]/mlibrary/bolt.git',
user => 'git',
require => [
Class["nebula::profile::github_pull_account"],
File["/opt/bolt"],
Package["git"],
Class['nebula::profile::github_pull_account'],
File['/opt/bolt'],
Package['git'],
]
}

lookup("nebula::profile::kubernetes::clusters", default_value => {}).each |$id, $cluster| {
lookup('nebula::profile::kubernetes::clusters', default_value => {}).each |$id, $cluster| {
$host = $cluster["control_dns"]

concat_fragment { "configure ssh client for ${id}":
Expand Down
46 changes: 23 additions & 23 deletions manifests/profile/certbot_cloudflare.pp
Original file line number Diff line number Diff line change
Expand Up @@ -9,46 +9,46 @@
class nebula::profile::certbot_cloudflare (
Hash[String, Hash[String, Array[String]]] $certs = {},
Hash[String, Array[String]] $simple_certs = {},
String $cert_dir = "/var/local/cert_dir",
String $haproxy_cert_dir = "/var/local/haproxy_cert_dir",
String $letsencrypt_email = "[email protected]",
String $cloudflare_api_token = "default.invalid",
String $cert_dir = '/var/local/cert_dir',
String $haproxy_cert_dir = '/var/local/haproxy_cert_dir',
String $letsencrypt_email = '[email protected]',
String $cloudflare_api_token = 'default.invalid',
) {
ensure_packages([
"certbot",
"python3-certbot-dns-cloudflare",
'certbot',
'python3-certbot-dns-cloudflare',
])

file { "/root/.secrets":
ensure => "directory"
file { '/root/.secrets':
ensure => 'directory'
}

file { "/root/.secrets/certbot":
ensure => "directory",
mode => "0700"
file { '/root/.secrets/certbot':
ensure => 'directory',
mode => '0700'
}

file { "/root/.secrets/certbot/cloudflare.ini":
mode => "0600",
content => template("nebula/profile/certbot_cloudflare/cloudflare.ini.erb")
file { '/root/.secrets/certbot/cloudflare.ini':
mode => '0600',
content => template('nebula/profile/certbot_cloudflare/cloudflare.ini.erb')
}

file { "/tmp/all_cert_commands_cloudflare":
content => template("nebula/profile/certbot_cloudflare/commands.erb")
file { '/tmp/all_cert_commands_cloudflare':
content => template('nebula/profile/certbot_cloudflare/commands.erb')
}

$certs.each |$service, $domains| {
$domains.each |$main_domain, $alt_domains| {
concat { "${cert_dir}/${main_domain}.crt":
group => "puppet",
group => 'puppet',
}

concat { "${cert_dir}/${main_domain}.key":
group => "puppet",
group => 'puppet',
}

concat { "${haproxy_cert_dir}/${service}/${main_domain}.pem":
group => "puppet",
group => 'puppet',
}

concat_fragment { "${main_domain}.crt cert":
Expand All @@ -62,13 +62,13 @@
}

concat_fragment { "${main_domain}.pem cert":
order => "01",
order => '01',
target => "${haproxy_cert_dir}/${service}/${main_domain}.pem",
source => "/etc/letsencrypt/live/${main_domain}/fullchain.pem"
}

concat_fragment { "${main_domain}.pem key":
order => "02",
order => '02',
target => "${haproxy_cert_dir}/${service}/${main_domain}.pem",
source => "/etc/letsencrypt/live/${main_domain}/privkey.pem"
}
Expand All @@ -77,7 +77,7 @@

$simple_certs.each |$domain, $sans| {
concat { "${cert_dir}/${domain}.crt":
group => "puppet",
group => 'puppet',
}

concat_fragment { "${cert_dir}/${domain}.crt cert":
Expand All @@ -86,7 +86,7 @@
}

concat { "${cert_dir}/${domain}.key":
group => "puppet",
group => 'puppet',
}

concat_fragment { "${cert_dir}/${domain}.key key":
Expand Down
Loading

0 comments on commit 83ac37b

Please sign in to comment.