~rvb/maas/ssfilter

« back to all changes in this revision

Viewing changes to utilities/maasdb

  • Committer: Gavin Panella
  • Date: 2012-03-15 13:58:32 UTC
  • mto: This revision was merged to the branch mainline in revision 291.
  • Revision ID: gavin.panella@canonical.com-20120315135832-8i2rkbvp6gwdhkzt
Change MaaS to MAAS everywhere.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
#! /bin/bash -e
2
2
#
3
 
# MaaS database control script.  See main() at the bottom for usage.
 
3
# MAAS database control script.  See main() at the bottom for usage.
4
4
#
5
5
# Most functions take as their first argument a database cluster's data
6
6
# directory.  This is where the database's socket, pidfile, log, and data will
26
26
 
27
27
    if test -z "$1"
28
28
    then
29
 
        echo "Specify a data directory for the MaaS database cluster." >&2
 
29
        echo "Specify a data directory for the MAAS database cluster." >&2
30
30
        return 1
31
31
    fi
32
32
    if ! echo "$DATADIR" | grep '^/'
96
96
}
97
97
 
98
98
 
99
 
# Initialize a MaaS database.
 
99
# Initialize a MAAS database.
100
100
maasdb_init_db() {
101
101
    local DATADIR DISPOSABLE MARKER
102
102
    DATADIR="`maasdb_locate "$1"`"
114
114
}
115
115
 
116
116
 
117
 
# Open a psql shell on a MaaS database.
 
117
# Open a psql shell on a MAAS database.
118
118
maasdb_shell() {
119
119
    local DATADIR
120
120
    DATADIR="`maasdb_locate "$1"`"
124
124
}
125
125
 
126
126
 
127
 
# Execute a query on a MaaS database.
 
127
# Execute a query on a MAAS database.
128
128
maasdb_query() {
129
129
    local DATADIR QUERY
130
130
    DATADIR="`maasdb_locate "$1"`"
135
135
}
136
136
 
137
137
 
138
 
# Delete an entire MaaS database and cluster.  Use only with extreme care!
 
138
# Delete an entire MAAS database and cluster.  Use only with extreme care!
139
139
maasdb_delete_cluster() {
140
140
    local DATADIR
141
141
    DATADIR="`maasdb_locate "$1"`"
142
142
 
143
 
    # Before deleting anything, does this at least look like a MaaS database
 
143
    # Before deleting anything, does this at least look like a MAAS database
144
144
    # cluster?
145
145
    if test -d "$DATADIR/base"
146
146
    then
169
169
  shell
170
170
  delete-cluster
171
171
 
172
 
And <cluster-path> is the path to the MaaS development database cluster,
 
172
And <cluster-path> is the path to the MAAS development database cluster,
173
173
typically "./db"
174
174
EOF
175
175
}