-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #39 from jean-edouard/stable-6-v4vmigration2
STABLE-6: Add migration script to fix the guest v4v firewall rules
- Loading branch information
Showing
3 changed files
with
54 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
-- | ||
-- Copyright (c) 2016 Assured Information Security, Inc. <[email protected]> | ||
-- | ||
-- This program is free software; you can redistribute it and/or modify | ||
-- it under the terms of the GNU General Public License as published by | ||
-- the Free Software Foundation; either version 2 of the License, or | ||
-- (at your option) any later version. | ||
-- | ||
-- This program is distributed in the hope that it will be useful, | ||
-- but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
-- GNU General Public License for more details. | ||
-- | ||
-- You should have received a copy of the GNU General Public License | ||
-- along with this program; if not, write to the Free Software | ||
-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
-- | ||
|
||
{-# LANGUAGE PatternGuards #-} | ||
|
||
-- description: Fix the guest v4v firewall rules | ||
-- date: 08/25/2016 | ||
|
||
module Migrations.M_31 (migration) where | ||
|
||
import UpgradeEngine | ||
import Data.List | ||
|
||
migration = Migration { | ||
sourceVersion = 31 | ||
, targetVersion = 32 | ||
, actions = act | ||
} | ||
|
||
act :: IO () | ||
act = do | ||
v4vRules | ||
|
||
v4vRules = xformVmJSON xform where | ||
xform tree | ||
| Just t <- typ, t `elem` ["svm"] = add_rules tree | ||
| otherwise = tree | ||
where | ||
typ = jsUnboxString `fmap` (jsGet "/type" tree) | ||
|
||
add_rules tree = foldl' (\t (p,v) -> jsSet p (jsBoxString v) t) (jsRm "/v4v-firewall-rules" tree) rules | ||
rules = [ ("/v4v-firewall-rules/0", "my-stubdom -> 0:4001") | ||
, ("/v4v-firewall-rules/1", "my-stubdom -> 0:4002") | ||
, ("/v4v-firewall-rules/2", "my-stubdom -> 0:5000") | ||
, ("/v4v-firewall-rules/3", "my-stubdom -> 0:5001") | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters