@@ -0,0 +1,3214 @@
+#%0A# Copyright 2015 Telefonica Investigacion y Desarrollo, S.A.U%0A#%0A# This file is part of IoT orchestrator%0A#%0A# IoT orchestrator is free software: you can redistribute it and/or%0A# modify it under the terms of the GNU Affero General Public License as%0A# published by the Free Software Foundation, either version 3 of the%0A# License, or (at your option) any later version.%0A#%0A# IoT orchestrator is distributed in the hope that it will be useful,%0A# but WITHOUT ANY WARRANTY; without even the implied warranty of%0A# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero%0A# General Public License for more details.%0A#%0A# You should have received a copy of the GNU Affero General Public License%0A# along with IoT orchestrator. If not, see http://www.gnu.org/licenses/.%0A#%0A# For those usages not covered by this license please contact with%0A# iot_support at tid dot es%0A#%0A# Author: IoT team%0A#%0Aimport sys%0Aimport pprint%0Aimport logging.config%0A%0Afrom settings.common import LOGGING%0Afrom orchestrator.core.flow.RemoveUser import RemoveUser%0A%0Alogging.config.dictConfig(LOGGING)%0A%0A%0Adef main():%0A%0A    print %22This script removes a User Service (aka keystone domain) in IoT Platform%22%0A%0A    print %22%22%0A%0A    SCRIPT_NAME = sys.argv%5B0%5D%0A    NUM_ARGS_EXPECTED = 7%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  %3CUSER_NAME%3E                     User 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%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                                 smartcity      %5C%5C%22%0A        print %22                                 Carl           %5C%5C%22%0A        print %22                                 adm1           %5C%5C%22%0A        print %22                                 password       %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    USER_NAME = sys.argv%5B5%5D%0A    SERVICE_ADMIN_USER = sys.argv%5B6%5D%0A    SERVICE_ADMIN_PASSWORD = sys.argv%5B7%5D%0A%0A    flow = RemoveUser(KEYSTONE_PROTOCOL,%0A                      KEYSTONE_HOST,%0A                      KEYSTONE_PORT)%0A%0A    user_detail = flow.removeUser(SERVICE_NAME,%0A                                  None,%0A                                  SERVICE_ADMIN_USER,%0A                                  SERVICE_ADMIN_PASSWORD,%0A                                  None,%0A                                  USER_NAME,%0A                                  None)%0A%0A    pprint.pprint(user_detail)%0A%0Aif __name__ == '__main__':%0A%0A    main()%0A

add command to remove a service user