Skip to content
This repository has been archived by the owner on Apr 21, 2024. It is now read-only.

Commit

Permalink
Create backups before running updates
Browse files Browse the repository at this point in the history
  • Loading branch information
Savidude authored and VimukthiPerera committed May 29, 2019
1 parent ce58392 commit c829ec0
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 32 deletions.
26 changes: 16 additions & 10 deletions modules/is/manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -59,14 +59,11 @@
* WSO2 Distribution
*/

# Create distribution path
file { [ "${products_dir}",
"${products_dir}/${product}" ]:
ensure => 'directory',
}

# Change the ownership of the installation directory to specified user & group
file { $distribution_path:
file { [ "${products_dir}",
"${products_dir}/${product}",
"${distribution_path}",
"${distribution_path}/backup" ]:
ensure => directory,
owner => $user,
group => $user_group,
Expand Down Expand Up @@ -101,9 +98,18 @@
refreshonly => true,
}

# Delete existing setup
exec { "detele-pack":
command => "rm -rf ${install_path}",
# Delete previous backup
exec { "delete-backup":
command => "rm -rf ${distribution_path}/backup/${product}-${product_version}",
path => "/bin/",
onlyif => "/usr/bin/test -d ${distribution_path}/backup/${product}-${product_version}",
subscribe => File["binary"],
refreshonly => true,
}

# Create backup
exec { "create backup":
command => "mv ${install_path} ${distribution_path}/backup",
path => "/bin/",
onlyif => "/usr/bin/test -d ${install_path}",
subscribe => File["binary"],
Expand Down
28 changes: 17 additions & 11 deletions modules/is_analytics_dashboard/manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -61,15 +61,12 @@
* WSO2 Distribution
*/

# Create distribution path
file { [ "${products_dir}",
"${products_dir}/${product}",
"${products_dir}/${product}/${profile}" ]:
ensure => 'directory',
}

# Change the ownership of the installation directory to specified user & group
file { $distribution_path:
file { [ "${products_dir}",
"${products_dir}/${product}",
"${products_dir}/${product}/${profile}",
"${distribution_path}",
"${distribution_path}/backup" ]:
ensure => directory,
owner => $user,
group => $user_group,
Expand Down Expand Up @@ -104,9 +101,18 @@
refreshonly => true,
}

# Delete existing setup
exec { "detele-pack":
command => "rm -rf ${install_path}",
# Delete previous backup
exec { "delete-backup":
command => "rm -rf ${distribution_path}/backup/${product}-${product_version}",
path => "/bin/",
onlyif => "/usr/bin/test -d ${distribution_path}/backup/${product}-${product_version}",
subscribe => File["binary"],
refreshonly => true,
}

# Create backup
exec { "create backup":
command => "mv ${install_path} ${distribution_path}/backup",
path => "/bin/",
onlyif => "/usr/bin/test -d ${install_path}",
subscribe => File["binary"],
Expand Down
28 changes: 17 additions & 11 deletions modules/is_analytics_worker/manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -61,15 +61,12 @@
* WSO2 Distribution
*/

# Create distribution path
file { [ "${products_dir}",
"${products_dir}/${product}",
"${products_dir}/${product}/${profile}" ]:
ensure => 'directory',
}

# Change the ownership of the installation directory to specified user & group
file { $distribution_path:
file { [ "${products_dir}",
"${products_dir}/${product}",
"${products_dir}/${product}/${profile}",
"${distribution_path}",
"${distribution_path}/backup" ]:
ensure => directory,
owner => $user,
group => $user_group,
Expand Down Expand Up @@ -104,9 +101,18 @@
refreshonly => true,
}

# Delete existing setup
exec { "detele-pack":
command => "rm -rf ${install_path}",
# Delete previous backup
exec { "delete-backup":
command => "rm -rf ${distribution_path}/backup/${product}-${product_version}",
path => "/bin/",
onlyif => "/usr/bin/test -d ${distribution_path}/backup/${product}-${product_version}",
subscribe => File["binary"],
refreshonly => true,
}

# Create backup
exec { "create backup":
command => "mv ${install_path} ${distribution_path}/backup",
path => "/bin/",
onlyif => "/usr/bin/test -d ${install_path}",
subscribe => File["binary"],
Expand Down

0 comments on commit c829ec0

Please sign in to comment.