mirror of
				https://github.com/zulip/zulip.git
				synced 2025-11-04 05:53:43 +00:00 
			
		
		
		
	upgrade-postgresql: Use tags to partially-apply configuration.
This uses the same technique used in840884ec89, to only apply select parts of the Puppet configuration. This is more correct, and simpler, than attempting to chop out some base puppet roles, and hack around the `purge => true` supervisor.d configuration. (cherry picked from commite13f82f048)
This commit is contained in:
		
				
					committed by
					
						
						Tim Abbott
					
				
			
			
				
	
			
			
			
						parent
						
							2fc5040b0b
						
					
				
				
					commit
					38421b77ea
				
			@@ -47,12 +47,13 @@ class zulip::postgresql_base {
 | 
				
			|||||||
    ensure  => link,
 | 
					    ensure  => link,
 | 
				
			||||||
    require => Package[$postgresql],
 | 
					    require => Package[$postgresql],
 | 
				
			||||||
    target  => $postgresql_dict_dict,
 | 
					    target  => $postgresql_dict_dict,
 | 
				
			||||||
 | 
					    tag     => ['postgresql_upgrade'],
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
  file { "${tsearch_datadir}/en_us.affix":
 | 
					  file { "${tsearch_datadir}/en_us.affix":
 | 
				
			||||||
    ensure  => link,
 | 
					    ensure  => link,
 | 
				
			||||||
    require => Package[$postgresql],
 | 
					    require => Package[$postgresql],
 | 
				
			||||||
    target  => $postgresql_dict_affix,
 | 
					    target  => $postgresql_dict_affix,
 | 
				
			||||||
 | 
					    tag     => ['postgresql_upgrade'],
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
  file { "${tsearch_datadir}/zulip_english.stop":
 | 
					  file { "${tsearch_datadir}/zulip_english.stop":
 | 
				
			||||||
    ensure  => file,
 | 
					    ensure  => file,
 | 
				
			||||||
@@ -61,6 +62,7 @@ class zulip::postgresql_base {
 | 
				
			|||||||
    group   => 'root',
 | 
					    group   => 'root',
 | 
				
			||||||
    mode    => '0644',
 | 
					    mode    => '0644',
 | 
				
			||||||
    source  => 'puppet:///modules/zulip/postgresql/zulip_english.stop',
 | 
					    source  => 'puppet:///modules/zulip/postgresql/zulip_english.stop',
 | 
				
			||||||
 | 
					    tag     => ['postgresql_upgrade'],
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
  zulip::nagios_plugins { 'zulip_postgresql': }
 | 
					  zulip::nagios_plugins { 'zulip_postgresql': }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -73,6 +75,7 @@ class zulip::postgresql_base {
 | 
				
			|||||||
        Package[$postgresql],
 | 
					        Package[$postgresql],
 | 
				
			||||||
        Exec[$setup_system_deps]
 | 
					        Exec[$setup_system_deps]
 | 
				
			||||||
      ],
 | 
					      ],
 | 
				
			||||||
 | 
					      tag     => ['postgresql_upgrade'],
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    exec { 'pgroonga-config':
 | 
					    exec { 'pgroonga-config':
 | 
				
			||||||
      require => Package["${postgresql}-pgdg-pgroonga"],
 | 
					      require => Package["${postgresql}-pgdg-pgroonga"],
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -61,6 +61,7 @@ class zulip::postgresql_common {
 | 
				
			|||||||
  zulip::safepackage { $postgresql_packages:
 | 
					  zulip::safepackage { $postgresql_packages:
 | 
				
			||||||
    ensure  => installed,
 | 
					    ensure  => installed,
 | 
				
			||||||
    require => Exec['generate-default-snakeoil'],
 | 
					    require => Exec['generate-default-snakeoil'],
 | 
				
			||||||
 | 
					    tag     => ['postgresql_upgrade'],
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  if $facts['os']['family'] == 'Debian' {
 | 
					  if $facts['os']['family'] == 'Debian' {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -12,15 +12,12 @@ class zulip::supervisor {
 | 
				
			|||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  $conf_dir = $zulip::common::supervisor_conf_dir
 | 
					  $conf_dir = $zulip::common::supervisor_conf_dir
 | 
				
			||||||
  # lint:ignore:quoted_booleans
 | 
					 | 
				
			||||||
  $should_purge = $facts['leave_supervisor'] != 'true'
 | 
					 | 
				
			||||||
  # lint:endignore
 | 
					 | 
				
			||||||
  file { $conf_dir:
 | 
					  file { $conf_dir:
 | 
				
			||||||
    ensure  => directory,
 | 
					    ensure  => directory,
 | 
				
			||||||
    require => Package['supervisor'],
 | 
					    require => Package['supervisor'],
 | 
				
			||||||
    owner   => 'root',
 | 
					    owner   => 'root',
 | 
				
			||||||
    group   => 'root',
 | 
					    group   => 'root',
 | 
				
			||||||
    purge   => $should_purge,
 | 
					    purge   => true,
 | 
				
			||||||
    recurse => true,
 | 
					    recurse => true,
 | 
				
			||||||
    notify  => Service[$supervisor_service],
 | 
					    notify  => Service[$supervisor_service],
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -75,7 +75,6 @@ fi
 | 
				
			|||||||
    cp /etc/zulip/zulip.conf "$TEMP_CONF_DIR"
 | 
					    cp /etc/zulip/zulip.conf "$TEMP_CONF_DIR"
 | 
				
			||||||
    ZULIP_CONF="${TEMP_CONF_DIR}/zulip.conf"
 | 
					    ZULIP_CONF="${TEMP_CONF_DIR}/zulip.conf"
 | 
				
			||||||
    crudini --set "$ZULIP_CONF" postgresql version "$UPGRADE_TO"
 | 
					    crudini --set "$ZULIP_CONF" postgresql version "$UPGRADE_TO"
 | 
				
			||||||
    crudini --set "$ZULIP_CONF" machine puppet_classes zulip::profile::base,zulip::postgresql_base
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if [ -f "/usr/share/postgresql/$UPGRADE_FROM/pgroonga_setup.sql.applied" ]; then
 | 
					    if [ -f "/usr/share/postgresql/$UPGRADE_FROM/pgroonga_setup.sql.applied" ]; then
 | 
				
			||||||
        # This file is intentionally blank, to trigger always running
 | 
					        # This file is intentionally blank, to trigger always running
 | 
				
			||||||
@@ -83,7 +82,7 @@ fi
 | 
				
			|||||||
        touch "/usr/share/postgresql/$UPGRADE_TO/pgroonga_setup.sql.applied"
 | 
					        touch "/usr/share/postgresql/$UPGRADE_TO/pgroonga_setup.sql.applied"
 | 
				
			||||||
    fi
 | 
					    fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    FACTER_LEAVE_SUPERVISOR=true "$ZULIP_PATH"/scripts/zulip-puppet-apply -f --config "$ZULIP_CONF"
 | 
					    "$ZULIP_PATH"/scripts/zulip-puppet-apply -f --config "$ZULIP_CONF" --tags postgresql_upgrade
 | 
				
			||||||
    rm -rf "$TEMP_CONF_DIR"
 | 
					    rm -rf "$TEMP_CONF_DIR"
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user