You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stratos.apache.org by pr...@apache.org on 2014/03/10 11:16:18 UTC

git commit: python cli work

Repository: incubator-stratos
Updated Branches:
  refs/heads/4.0.0-incubating-cli a3c09483a -> 5230f9e60


python cli work


Project: http://git-wip-us.apache.org/repos/asf/incubator-stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-stratos/commit/5230f9e6
Tree: http://git-wip-us.apache.org/repos/asf/incubator-stratos/tree/5230f9e6
Diff: http://git-wip-us.apache.org/repos/asf/incubator-stratos/diff/5230f9e6

Branch: refs/heads/4.0.0-incubating-cli
Commit: 5230f9e60a2991ae64e478d7efd7c8d61f732d02
Parents: a3c0948
Author: Pradeep Fernando <pr...@gmail.com>
Authored: Mon Mar 10 15:45:41 2014 +0530
Committer: Pradeep Fernando <pr...@gmail.com>
Committed: Mon Mar 10 15:45:41 2014 +0530

----------------------------------------------------------------------
 products/stratos-cli/python-cli/cli/__init__.py |   1 +
 .../stratos-cli/python-cli/cli/__init__.pyc     | Bin 0 -> 205 bytes
 .../python-cli/cli/cmdinterpretor.py            |  11 ++++
 .../python-cli/cli/cmdinterpretor.pyc           | Bin 0 -> 937 bytes
 .../python-cli/cli/receivers/__init__.py        |   1 +
 .../python-cli/cli/receivers/tenantmgt.py       |   1 +
 products/stratos-cli/python-cli/cli/stratos.py  |  54 +++++++++++++++++++
 products/stratos-cli/python-cli/cli/stratos.pyc | Bin 0 -> 737 bytes
 8 files changed, 68 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/5230f9e6/products/stratos-cli/python-cli/cli/__init__.py
----------------------------------------------------------------------
diff --git a/products/stratos-cli/python-cli/cli/__init__.py b/products/stratos-cli/python-cli/cli/__init__.py
new file mode 100644
index 0000000..d632ccc
--- /dev/null
+++ b/products/stratos-cli/python-cli/cli/__init__.py
@@ -0,0 +1 @@
+__author__ = 'pradeep'

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/5230f9e6/products/stratos-cli/python-cli/cli/__init__.pyc
----------------------------------------------------------------------
diff --git a/products/stratos-cli/python-cli/cli/__init__.pyc b/products/stratos-cli/python-cli/cli/__init__.pyc
new file mode 100644
index 0000000..799b833
Binary files /dev/null and b/products/stratos-cli/python-cli/cli/__init__.pyc differ

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/5230f9e6/products/stratos-cli/python-cli/cli/cmdinterpretor.py
----------------------------------------------------------------------
diff --git a/products/stratos-cli/python-cli/cli/cmdinterpretor.py b/products/stratos-cli/python-cli/cli/cmdinterpretor.py
new file mode 100644
index 0000000..3ffba0a
--- /dev/null
+++ b/products/stratos-cli/python-cli/cli/cmdinterpretor.py
@@ -0,0 +1,11 @@
+import cmd
+
+class CmdInterpretor(cmd.Cmd):
+
+    prompt = 'stratos>'
+
+    def do_add(self, line):
+        print 'command line intepretor working'
+
+    def do_EOF(self, line):
+        return True
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/5230f9e6/products/stratos-cli/python-cli/cli/cmdinterpretor.pyc
----------------------------------------------------------------------
diff --git a/products/stratos-cli/python-cli/cli/cmdinterpretor.pyc b/products/stratos-cli/python-cli/cli/cmdinterpretor.pyc
new file mode 100644
index 0000000..ba67e03
Binary files /dev/null and b/products/stratos-cli/python-cli/cli/cmdinterpretor.pyc differ

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/5230f9e6/products/stratos-cli/python-cli/cli/receivers/__init__.py
----------------------------------------------------------------------
diff --git a/products/stratos-cli/python-cli/cli/receivers/__init__.py b/products/stratos-cli/python-cli/cli/receivers/__init__.py
new file mode 100644
index 0000000..d632ccc
--- /dev/null
+++ b/products/stratos-cli/python-cli/cli/receivers/__init__.py
@@ -0,0 +1 @@
+__author__ = 'pradeep'

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/5230f9e6/products/stratos-cli/python-cli/cli/receivers/tenantmgt.py
----------------------------------------------------------------------
diff --git a/products/stratos-cli/python-cli/cli/receivers/tenantmgt.py b/products/stratos-cli/python-cli/cli/receivers/tenantmgt.py
new file mode 100644
index 0000000..d632ccc
--- /dev/null
+++ b/products/stratos-cli/python-cli/cli/receivers/tenantmgt.py
@@ -0,0 +1 @@
+__author__ = 'pradeep'

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/5230f9e6/products/stratos-cli/python-cli/cli/stratos.py
----------------------------------------------------------------------
diff --git a/products/stratos-cli/python-cli/cli/stratos.py b/products/stratos-cli/python-cli/cli/stratos.py
new file mode 100755
index 0000000..f796fe8
--- /dev/null
+++ b/products/stratos-cli/python-cli/cli/stratos.py
@@ -0,0 +1,54 @@
+#!/usr/bin/python
+import optparse
+import sys
+import os
+import logging
+import cmdinterpretor
+import cmd
+
+
+log = logging.getLogger(__name__)
+
+#this is the entry point of the commandline client.
+#   1. enter in to stratos shell session
+#   2. use the 'stratos' a unix command
+def authenticate_authorize():
+    parser = optparse.OptionParser(version='1.0', description='Command line tool to interact with stratos backend')
+    parser.add_option('--username', '-u')
+    parser.add_option('--password', '-p')
+
+    options, arguments = parser.parse_args()
+    if options.username == None or options.username == '' or options.password == None or options.password == '':
+        log.debug("username/passoword empty")
+        print 'please enter valid username/password'
+        sys.exit(1)  #throw exception and handle it in the driver class. less readable
+
+    print options.username
+    print options.password
+
+def activate_console():
+    cmdinterpretor.CmdInterpretor().cmdloop('stratos>')
+
+
+
+def start_stratos_client():
+    authenticate_authorize()
+    activate_console()
+
+
+def main():
+    try:
+        #execute the stratos shell
+       start_stratos_client()
+    except Exception as e:
+        log.info(e.message, e)
+        print e.message
+        print 'Exception'
+        sys.exit(1)
+    except KeyboardInterrupt as e:
+        print('Shutting down stratos client')
+        sys.exit(1)
+
+
+if __name__ == '__main__':
+    main()
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/5230f9e6/products/stratos-cli/python-cli/cli/stratos.pyc
----------------------------------------------------------------------
diff --git a/products/stratos-cli/python-cli/cli/stratos.pyc b/products/stratos-cli/python-cli/cli/stratos.pyc
new file mode 100644
index 0000000..f43c07e
Binary files /dev/null and b/products/stratos-cli/python-cli/cli/stratos.pyc differ