nagarajabalur / mywordpress

0 stars 0 forks source link

Resources are not idempotent #5

Closed gau1991 closed 8 years ago

gau1991 commented 8 years ago

Following resources are not idempotent.


# extract the downloaded tar file
execute 'extract_some_tar' do
  command 'tar xzvf latest.tar.gz'
  cwd '/etc'
  only_if { File.exist?('/etc/latest.tar.gz') }
end

# copy the content of wordpress to /var/www/html
execute 'copy the wordpress content' do
  command 'cp -r /etc/wordpress/* /var/www/html'
end

Always make sure that your resources are idempotent.

nagarajabalur commented 8 years ago

added idempotent resources by adding :+1:

extract the downloaded tar file

execute 'extract_some_tar' do command 'tar xzvf latest.tar.gz' cwd '/tmp/kitchen/cache' not_if { File.exists?("/tmp/kitchen/cache/wordpress/index.php") } end

copy the content of wordpress to /var/www/html

execute 'copy the wordpress content' do command 'cp -r /tmp/kitchen/cache/wordpress/* /var/www/html' not_if { File.exists?("/var/www/html/wordpress/index.php") } end