add precond check to db deploy script
This commit is contained in:
@@ -6,6 +6,10 @@ use warnings FATAL => 'all';
|
|||||||
use Dancer ':script';
|
use Dancer ':script';
|
||||||
use Dancer::Plugin::DBIC 'schema';
|
use Dancer::Plugin::DBIC 'schema';
|
||||||
|
|
||||||
|
use 5.10.0;
|
||||||
|
use Term::UI;
|
||||||
|
use Term::ReadLine;
|
||||||
|
|
||||||
use HTTP::Tiny;
|
use HTTP::Tiny;
|
||||||
use Try::Tiny;
|
use Try::Tiny;
|
||||||
|
|
||||||
@@ -18,15 +22,15 @@ user with rights to create tables in that database. Both the table and user
|
|||||||
name must match those configured in your environment YAML file (default
|
name must match those configured in your environment YAML file (default
|
||||||
C<environments/development.yml>).
|
C<environments/development.yml>).
|
||||||
|
|
||||||
|
Additionally this script will download the latest MAC address vendor prefix
|
||||||
|
data from the Internet, and update the OUI table in the database. Hence
|
||||||
|
Internet access is required to run the script.
|
||||||
|
|
||||||
Simply run this script, which connects to the database and runs without user
|
Simply run this script, which connects to the database and runs without user
|
||||||
interaction. If there's no Nedisco schema, it is deployed. If there's an
|
interaction. If there's no Nedisco schema, it is deployed. If there's an
|
||||||
unversioned schema then versioning is added, and updates applied. Otherwise
|
unversioned schema then versioning is added, and updates applied. Otherwise
|
||||||
only necessary updates are applied to an already versioned schema.
|
only necessary updates are applied to an already versioned schema.
|
||||||
|
|
||||||
Additionally this script will download the latest MAC address vendor prefix
|
|
||||||
data from the Internet, and update the OUI table in the database. Hence
|
|
||||||
Internet access is required to run the script.
|
|
||||||
|
|
||||||
=head2 Versions
|
=head2 Versions
|
||||||
|
|
||||||
=over 4
|
=over 4
|
||||||
@@ -51,6 +55,20 @@ Version 4 (not yet created) B<will diverge from "classic" Netdisco 1.x>
|
|||||||
|
|
||||||
=cut
|
=cut
|
||||||
|
|
||||||
|
say 'The following must be in place:';
|
||||||
|
say ' * Internet access';
|
||||||
|
say ' * Database added to PostgreSQL for Netdisco';
|
||||||
|
say ' * User added to PostgreSQL with rights to the Database';
|
||||||
|
say ' * "environments/development.yml" file configured with Database dsn/user/pass';
|
||||||
|
say '';
|
||||||
|
|
||||||
|
my $term = Term::ReadLine->new('netdisco');
|
||||||
|
my $bool = $term->ask_yn(
|
||||||
|
prompt => 'Ready to deploy?', default => 'n',
|
||||||
|
);
|
||||||
|
|
||||||
|
exit(0) unless $bool;
|
||||||
|
|
||||||
my $schema = schema('netdisco');
|
my $schema = schema('netdisco');
|
||||||
|
|
||||||
# installs the dbix_class_schema_versions table with version "1"
|
# installs the dbix_class_schema_versions table with version "1"
|
||||||
|
|||||||
Reference in New Issue
Block a user