@@ -0,0 +1,2820 @@
+import sys%0Aimport pprint%0Afrom orchestrator.core.flow.Roles import Roles%0A%0A%0A%0Adef main():%0A%0A    print %22This script prints roles in a service%22%0A%0A    print %22%22%0A    %0A    SCRIPT_NAME=sys.argv%5B0%5D%0A    NUM_ARGS_EXPECTED=6%0A%0A    if (len(sys.argv) - 1 %3C NUM_ARGS_EXPECTED):%0A        print %22Usage: %25s %5Bargs%5D%22 %25 SCRIPT_NAME%0A        print %22Args: %22%0A        print %22  %3CKEYSTONE_PROTOCOL%3E             HTTP or HTTPS%22%0A        print %22  %3CKEYSTONE_HOST%3E                 Keystone HOSTNAME or IP%22%0A        print %22  %3CKEYSTONE_PORT%3E                 Keystone PORT%22%0A        print %22  %3CSERVICE_NAME%3E                  Service name%22%0A        print %22  %3CSERVICE_ADMIN_USER%3E            Service admin username%22%0A        print %22  %3CSERVICE_ADMIN_PASSWORD%3E        Service admin password%22%0A        # print %22  %3CSUBSERVICE_NAME%3E               SubService name (optional)%22%0A        # print %22  %3CROLE_NAME%3E                     Role Name (optional)%22%0A        # print %22  %3CUSER_NAME%3E                     User Name (optional)%22%0A        # print %22  %3CEFFECTIVE%3E                     Effective roles (optional)%22%0A        print %22%22%0A        print %22  Typical usage:%22%0A        print %22     %25s http           %5C%5C%22 %25 SCRIPT_NAME%0A        print %22                                 localhost      %5C%5C%22%0A        print %22                                 5000           %5C%5C%22%0A        print %22                                 SmartValencia  %5C%5C%22%0A        print %22                                 adm1           %5C%5C%22%0A        print %22                                 password       %5C%5C%22%0A        # print %22                                 Electricidad   %5C%5C%22%0A        # print %22                                 SubServiceAdmin%5C%5C%22%0A        # print %22                                 Alice          %5C%5C%22%0A        # print %22                                 True           %5C%5C%22%0A        print %22%22%0A        print %22For bug reporting, please contact with:%22%0A        print %22%3Ciot_support@tid.es%3E%22%0A        return%0A%0A    KEYSTONE_PROTOCOL=sys.argv%5B1%5D%0A    KEYSTONE_HOST=sys.argv%5B2%5D%0A    KEYSTONE_PORT=sys.argv%5B3%5D%0A    SERVICE_NAME=sys.argv%5B4%5D%0A    SERVICE_ADMIN_USER=sys.argv%5B5%5D%0A    SERVICE_ADMIN_PASSWORD=sys.argv%5B6%5D%0A    # SUBSERVICE_NAME=sys.argv%5B7%5D%0A    # ROLE_NAME=sys.argv%5B8%5D%0A    # USER_NAME=sys.argv%5B9%5D%0A    # EFFECTIVE=sys.argv%5B10%5D%0A%0A    flow = Roles(KEYSTONE_PROTOCOL,%0A                 KEYSTONE_HOST,%0A                 KEYSTONE_PORT)%0A%0A    roles = flow.roles_assignments(None,%0A                                   SERVICE_NAME,%0A                                   None,                                   %0A                                   None,%0A                                   None,%0A                                   SERVICE_ADMIN_USER,%0A                                   SERVICE_ADMIN_PASSWORD,%0A                                   None,%0A                                   True)%0A%0A    pprint.pprint(roles)%0A%0A%0A%0Aif __name__ == '__main__':%0A    %0A    main()%0A

add command to list roles