You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by bh...@apache.org on 2016/08/22 11:06:33 UTC
[1/3] git commit: updated refs/heads/master to 3c2e8b9
Repository: cloudstack
Updated Branches:
refs/heads/master b6bf093a3 -> 3c2e8b929
CLOUDSTACK-9463: Fix dynamic-roles migrate script for old format
The old commands.properties format included the full class name such as:
createAccount=com.cloud.api.commands.CreateAccountCmd;1
The migration script did not consider this format and fails. With this fix
the migration script will process both the formats, including processing a
commands.properties file with mixed format, for example:
$ cat commands.properties
### Account commands
createAccount=1
deleteAccount=2
markDefaultZoneForAccount=com.cloud.api.commands.MarkDefaultZoneForAccountCmd;3
$ python scripts/util/migrate-dynamicroles.py -d -f commands.properties
Apache CloudStack Role Permission Migration Tool
(c) Apache CloudStack Authors and the ASF, under the Apache License, Version 2.0
Running this migration tool will remove any default-role permissions from cloud.role_permissions. Do you want to continue? [y/N]y
The commands.properties file has been deprecated and moved at: commands.properties.deprecated
Running SQL query: DELETE FROM `cloud`.`role_permissions` WHERE `role_id` in (1,2,3,4);
Running SQL query: INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 1, '*', 'ALLOW', 0);
Running SQL query: INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'deleteAccount', 'ALLOW', 0);
Running SQL query: INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'markDefaultZoneForAccount', 'ALLOW', 1);
Static role permissions from commands.properties have been migrated into the db
Running SQL query: UPDATE `cloud`.`configuration` SET value='true' where name='dynamic.apichecker.enabled'
Dynamic role based API checker has been enabled!
Signed-off-by: Rohit Yadav <ro...@shapeblue.com>
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/f699fd4a
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/f699fd4a
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/f699fd4a
Branch: refs/heads/master
Commit: f699fd4a15c8e58c534e98d8436beedf3b54fdc5
Parents: bdc409c
Author: Rohit Yadav <ro...@shapeblue.com>
Authored: Fri Aug 19 17:27:20 2016 +0530
Committer: Rohit Yadav <ro...@shapeblue.com>
Committed: Fri Aug 19 17:33:07 2016 +0530
----------------------------------------------------------------------
scripts/util/migrate-dynamicroles.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/f699fd4a/scripts/util/migrate-dynamicroles.py
----------------------------------------------------------------------
diff --git a/scripts/util/migrate-dynamicroles.py b/scripts/util/migrate-dynamicroles.py
index d2356fb..cbb83f9 100755
--- a/scripts/util/migrate-dynamicroles.py
+++ b/scripts/util/migrate-dynamicroles.py
@@ -107,10 +107,10 @@ def main():
apiMap = {}
with open(options.commandsfile) as f:
for line in f.readlines():
- if not line or line == '' or line == '\n' or line.startswith('#'):
+ if not line or line == '' or line == '\n' or line == '\r\n' or line.startswith('#'):
continue
name, value = line.split('=')
- apiMap[name.strip()] = value.strip()
+ apiMap[name.strip()] = value.strip().split(';')[-1]
# Rename and deprecate old commands.properties file
if not dryrun:
[2/3] git commit: updated refs/heads/master to 3c2e8b9
Posted by bh...@apache.org.
Merge pull request #1649 from shapeblue/4.9-upgraderolescriptfix
CLOUDSTACK-9463: Fix dynamic-roles migrate script for old formatThe old commands.properties format included the full class name such as:
createAccount=com.cloud.api.commands.CreateAccountCmd;1
The migration script did not consider this format and fails. With this fix
the migration script will process both the formats, including processing a
commands.properties file with mixed format, for example:
$ cat commands.properties
### Account commands
createAccount=1
deleteAccount=2
markDefaultZoneForAccount=com.cloud.api.commands.MarkDefaultZoneForAccountCmd;3
$ python scripts/util/migrate-dynamicroles.py -d -f commands.properties
Apache CloudStack Role Permission Migration Tool
(c) Apache CloudStack Authors and the ASF, under the Apache License, Version 2.0
Running this migration tool will remove any default-role permissions from cloud.role_permissions. Do you want to continue? [y/N]y
The commands.properties file has been deprecated and moved at: commands.properties.deprecated
Running SQL query: DELETE FROM `cloud`.`role_permissions` WHERE `role_id` in (1,2,3,4);
Running SQL query: INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 1, '*', 'ALLOW', 0);
Running SQL query: INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'deleteAccount', 'ALLOW', 0);
Running SQL query: INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'markDefaultZoneForAccount', 'ALLOW', 1);
Static role permissions from commands.properties have been migrated into the db
Running SQL query: UPDATE `cloud`.`configuration` SET value='true' where name='dynamic.apichecker.enabled'
Dynamic role based API checker has been enabled!
/cc @jburwell @karuturi @PaulAngus
Since we don't have any upgrade/marvin tests for this, the changes have been verified with above test as the script works against a commands.properties. A manual verification by anyone else would be required to validate the changes.
* pr/1649:
CLOUDSTACK-9463: Fix dynamic-roles migrate script for old format
Signed-off-by: Rohit Yadav <ro...@shapeblue.com>
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/cc0e2a6b
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/cc0e2a6b
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/cc0e2a6b
Branch: refs/heads/master
Commit: cc0e2a6b0649807629ff48c4c22c05b81907db7f
Parents: 1060dc4 f699fd4
Author: Rohit Yadav <ro...@shapeblue.com>
Authored: Mon Aug 22 16:35:51 2016 +0530
Committer: Rohit Yadav <ro...@shapeblue.com>
Committed: Mon Aug 22 16:35:51 2016 +0530
----------------------------------------------------------------------
scripts/util/migrate-dynamicroles.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
[3/3] git commit: updated refs/heads/master to 3c2e8b9
Posted by bh...@apache.org.
Merge branch '4.9'
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/3c2e8b92
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/3c2e8b92
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/3c2e8b92
Branch: refs/heads/master
Commit: 3c2e8b92946b0f03099e4120e05eeda32829ac7b
Parents: b6bf093 cc0e2a6
Author: Rohit Yadav <ro...@shapeblue.com>
Authored: Mon Aug 22 16:36:24 2016 +0530
Committer: Rohit Yadav <ro...@shapeblue.com>
Committed: Mon Aug 22 16:36:24 2016 +0530
----------------------------------------------------------------------
scripts/util/migrate-dynamicroles.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------