Document the last file presence.

Smart hooks may want to perform delta analysis on metadata, and tests
want to be able to tell if the cache is updated it's previous state,
so we should make the presence and name of the old versions of the
files a stable interface.

Change-Id: Ia29c1ef9e10308d6461dae7823c5f497f6b90122
This commit is contained in:
Robert Collins 2013-08-16 15:13:58 +12:00
parent 98c8588867
commit 4bdefc2041
2 changed files with 14 additions and 0 deletions

View File

@ -31,6 +31,8 @@ These sources will be polled and whenever any of them changes, default.command w
/var/run/os-collect-config/ec2.json:/var/run/os-collect-config/cfn.json
```
The previous version of the metadata from a source (if available) is present at $FILENAME.last.
When run without a command, the metadata sources are printed as a json document.
# Quick Start

View File

@ -13,6 +13,18 @@
# See the License for the specific language governing permissions and
# limitations under the License.
"""Metadata cache.
Files within the cache as passed to hook commands invoked by
os-collect-command.
The cache also stores the last version of a file in order to detect changes
that occur - hook commands are only automatically invoked when one or more
metadata sources have changed things.
The last version of a file is available under $FILENAME.last.
"""
import json
import os
import shutil