Merge pull request #156 from tokuhirom/dry_run

Added dry_run button. close #152
This commit is contained in:
Matej Kramny 2016-07-21 15:26:18 +01:00 committed by GitHub
commit 47b1fcebf9
6 changed files with 15 additions and 2 deletions

View File

@ -258,6 +258,10 @@ func (t *task) runPlaybook() error {
args = append(args, "-vvvv")
}
if t.task.DryRun {
args = append(args, "--check")
}
if len(t.environment.JSON) > 0 {
args = append(args, "--extra-vars", t.environment.JSON)
}

1
db/migrations/v1.8.0.sql Normal file
View File

@ -0,0 +1 @@
ALTER TABLE task ADD dry_run tinyint(1) NOT NULL DEFAULT 0 AFTER debug;

View File

@ -64,5 +64,6 @@ func init() {
{Minor: 1},
{Major: 1, Minor: 6},
{Major: 1, Minor: 7},
{Major: 1, Minor: 8},
}
}

View File

@ -9,6 +9,8 @@ type Task struct {
Status string `db:"status" json:"status"`
Debug bool `db:"debug" json:"debug"`
DryRun bool `db:"dry_run" json:"dry_run"`
// override variables
Playbook string `db:"playbook" json:"playbook"`
Environment string `db:"environment" json:"environment"`

View File

@ -20,4 +20,5 @@
.modal-footer
button.btn.btn-default.pull-left(ng-click="$dismiss()") Dismiss
button.btn.btn-primary(ng-click="run(task, true)") Dry Run
button.btn.btn-success(ng-click="run(task)") Run!

View File

@ -3,10 +3,14 @@ define(function () {
console.log(Template);
$scope.task = {};
$scope.run = function (task) {
$scope.run = function (task, dryRun) {
task.template_id = Template.id;
$http.post(Project.getURL() + '/tasks', task).success(function (t) {
var params = angular.copy(task);
if (dryRun) {
params.dry_run = true;
}
$http.post(Project.getURL() + '/tasks', params).success(function (t) {
$scope.$close(t);
}).error(function (_, status) {
swal('Error', 'error launching task: HTTP ' + status, 'error');