cloudstack-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF subversion and git services (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CLOUDSTACK-9463) Dynamic roles migrate script fails with old commands.properties file format
Date Wed, 24 Aug 2016 06:58:21 GMT

    [ https://issues.apache.org/jira/browse/CLOUDSTACK-9463?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15434306#comment-15434306
] 

ASF subversion and git services commented on CLOUDSTACK-9463:
-------------------------------------------------------------

Commit cc0e2a6b0649807629ff48c4c22c05b81907db7f in cloudstack's branch refs/heads/4.9-systemdubuntupkging
from [~rohit.yadav@shapeblue.com]
[ https://git-wip-us.apache.org/repos/asf?p=cloudstack.git;h=cc0e2a6 ]

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 <rohit.yadav@shapeblue.com>


> Dynamic roles migrate script fails with old commands.properties file format
> ---------------------------------------------------------------------------
>
>                 Key: CLOUDSTACK-9463
>                 URL: https://issues.apache.org/jira/browse/CLOUDSTACK-9463
>             Project: CloudStack
>          Issue Type: Bug
>      Security Level: Public(Anyone can view this level - this is the default.) 
>            Reporter: Rohit Yadav
>            Assignee: Rohit Yadav
>             Fix For: 4.10.0, 4.9.1
>
>
> The old commands.properties format included the full class name such as:    
>     createAccount=com.cloud.api.commands.CreateAccountCmd;1
> /usr/share/cloudstack-common/scripts/util/migrate-dynamicroles.py -d -f /tmp/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
> Traceback (most recent call last):
> File "/usr/share/cloudstack-common/scripts/util/migrate-dynamicroles.py", line 136, in
<module>
> main()
> File "/usr/share/cloudstack-common/scripts/util/migrate-dynamicroles.py", line 112, in
main
> name, value = line.split('=')
> ValueError: need more than 1 value to unpack



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message