- From: Noah Kantrowitz <
>
- To:
- Subject: [chef] Re: Chef Pattern for renaming things
- Date: Wed, 31 Jul 2013 11:46:32 -0700
On Jul 31, 2013, at 11:38 AM, Steven Barre
<
>
wrote:
>
What is the best way to handle renaming things?
>
>
In my case I've got domains listed in a data bag and use the apache2
>
cookbook to create / manage them.
>
>
If I need to rename a domain, but keep all its files around, how best would
>
I do this in an idempotent way?
>
>
Should I store the old and current domain name in the data bag and check if
>
they are different and if so create the new domain, move files, then delete
>
the old?
>
>
I'm more looking for a pattern since I may need to rename databases and
>
users as well.
Renaming is somewhat inherently not idempotent but the closest you can
probably get is
if exists(new)
if exists(old)
remove(old)
update(new)
else
if exists(old)
rename(old, new)
else
create(new)
Each of those 5 operations (exists, rename, create, remove, update) will vary
depending on the situation.
--Noah
Attachment:
signature.asc
Description: Message signed with OpenPGP using GPGMail
Archive powered by MHonArc 2.6.16.