Skip to content

Commit

Permalink
move user/group management to prerequisites to prevent dependency cycles
Browse files Browse the repository at this point in the history
  • Loading branch information
mcrauwel committed Sep 8, 2018
1 parent ed2a8e5 commit d2594b3
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 10 deletions.
5 changes: 3 additions & 2 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@
# Which configuration variables should be overriden. Hash, defaults to {} (empty hash).
#
# * `cluster_name`
# If set, proxysql_servers with the same cluster_name will be automatically added to the same cluster and will
# If set, proxysql_servers with the same cluster_name will be automatically added to the same cluster and will
# synchronize their configuration parameters. Defaults to undef
#
# * `cluster_username`
Expand All @@ -116,7 +116,7 @@
# The name of the mysql client package in your package manager. Defaults to undef
#
# * `manage_hostgroup_for_servers`
# Determines wheter this module will manage hostgroup_id for mysql_servers.
# Determines wheter this module will manage hostgroup_id for mysql_servers.
# If false - it will skip difference in this value between manifest and defined in ProxySQL. Defaults to 'true'
#
# * `mysql_servers`
Expand Down Expand Up @@ -242,6 +242,7 @@
# lint:endignore

anchor { 'proxysql::begin': }
-> class { 'proxysql::prerequisites':}
-> class { 'proxysql::repo':}
-> class { 'proxysql::install':}
-> class { 'proxysql::config':}
Expand Down
8 changes: 0 additions & 8 deletions manifests/install.pp
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,6 @@
}
}

group { $proxysql::sys_group:
ensure => 'present',
}

user { $proxysql::sys_owner:
ensure => 'present',
groups => $proxysql::sys_group,
}

file { 'proxysql-datadir':
ensure => directory,
Expand Down
18 changes: 18 additions & 0 deletions manifests/prerequisites.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Class: proxysql::prerequisites
# ===========================
#
# Manage the prerequisites where the ProxySQL package might be
#
class proxysql::prerequisites inherits proxysql {
if $proxysql::sys_owner != 'root' { # let's assume that 'root' will exist and not touch that...
group { $proxysql::sys_group:
ensure => 'present',
}

user { $proxysql::sys_owner:
ensure => 'present',
groups => $proxysql::sys_group,
}
}

}

0 comments on commit d2594b3

Please sign in to comment.