Skip to content
This repository was archived by the owner on May 12, 2021. It is now read-only.

Commit da6b7e4

Browse files
committed
Added POM and distribution for Python CLI. Fixed import issues in the CLI
1 parent f36e3f4 commit da6b7e4

File tree

18 files changed

+443
-24
lines changed

18 files changed

+443
-24
lines changed
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<!--
2+
~ Licensed to the Apache Software Foundation (ASF) under one
3+
~ or more contributor license agreements. See the NOTICE file
4+
~ distributed with this work for additional information
5+
~ regarding copyright ownership. The ASF licenses this file
6+
~ to you under the Apache License, Version 2.0 (the
7+
~ "License"); you may not use this file except in compliance
8+
~ with the License. You may obtain a copy of the License at
9+
~
10+
~ http://www.apache.org/licenses/LICENSE-2.0
11+
~
12+
~ Unless required by applicable law or agreed to in writing,
13+
~ software distributed under the License is distributed on an
14+
~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
~ KIND, either express or implied. See the License for the
16+
~ specific language governing permissions and limitations
17+
~ under the License.
18+
-->
19+
20+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
21+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
22+
<modelVersion>4.0.0</modelVersion>
23+
<parent>
24+
<groupId>org.apache.stratos</groupId>
25+
<artifactId>stratos-components-parent</artifactId>
26+
<version>4.1.4-SNAPSHOT</version>
27+
</parent>
28+
29+
<artifactId>org.apache.stratos.python.cli</artifactId>
30+
<packaging>pom</packaging>
31+
<name>Apache Stratos - Python CLI</name>
32+
</project>

components/org.apache.stratos.python.cli/src/main/python/README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11
Apache Stratos CLI
22
==================
3+
4+
#Pre-requisites
5+
Install the required Python packages by issuing the following `pip install` commands.
6+
7+
```python
8+
pip install cmd2
9+
pip install texttable
10+
11+
12+
```
313

414
Build and install stratos CLI by,
515

components/org.apache.stratos.python.cli/src/main/python/cli/CLI.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
from Utils import *
2020
from Stratos import *
2121
import Configs
22-
from cli.exceptions import BadResponseError
22+
from Exceptions import BadResponseError
2323

2424

2525
class CLI(Cmd):
Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
# "License"); you may not use this file except in compliance
77
# with the License. You may obtain a copy of the License at
88
#
9-
# http://www.apache.org/licenses/LICENSE-2.0
9+
# http://www.apache.org/licenses/LICENSE-2.0
1010
#
1111
# Unless required by applicable law or agreed to in writing,
1212
# software distributed under the License is distributed on an
@@ -15,10 +15,11 @@
1515
# specific language governing permissions and limitations
1616
# under the License.
1717

18+
1819
class BadResponseError(Exception):
1920
def __init__(self, error_code, message=""):
2021
self.error_code = error_code
2122
self.message = message
2223

2324
def __str__(self):
24-
return self.message
25+
return self.message

components/org.apache.stratos.python.cli/src/main/python/cli/Main.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@
2222
import Configs
2323

2424
# Fix Python 2.x.
25-
from cli.Stratos import Stratos
26-
from cli.exceptions import BadResponseError
25+
from Stratos import Stratos
26+
from Exceptions import BadResponseError
2727

2828
try:
2929
input = raw_input

components/org.apache.stratos.python.cli/src/main/python/cli/Stratos.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
import json
2020
import Configs
2121
from Logging import logging
22-
from cli.exceptions.BadResponseError import BadResponseError
22+
from Exceptions import BadResponseError
2323

2424

2525
class Stratos:

components/org.apache.stratos.python.cli/src/main/python/cli/exceptions/__init__.py

Lines changed: 0 additions & 17 deletions
This file was deleted.

components/org.apache.stratos.python.cli/src/main/python/setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ def read(file_name):
2525

2626
setup(
2727
name="stratos",
28-
version="0.0.5",
28+
version="4.1.4",
2929
author="Apache Stratos",
3030
author_email="[email protected]",
3131
description="CLI tool to interact with Apache Stratos",

components/org.apache.stratos.python.cli/src/main/python/tox.ini

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@
22
envlist = py27, py34
33
[testenv]
44
deps=pytest
5+
responses
56
commands=py.test

components/pom.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
<module>org.apache.stratos.manager</module>
4141
<module>org.apache.stratos.cli</module>
4242
<module>org.apache.stratos.python.cartridge.agent</module>
43+
<module>org.apache.stratos.python.cli</module>
4344
<module>org.apache.stratos.cartridge.agent</module>
4445
<module>org.apache.stratos.load.balancer.common</module>
4546
<module>org.apache.stratos.load.balancer</module>

pom.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -680,6 +680,7 @@
680680
<java.cartridge.agent.distribution.name>apache-stratos-cartridge-agent</java.cartridge.agent.distribution.name>
681681
<python.cartridge.agent.distribution.name>apache-stratos-python-cartridge-agent
682682
</python.cartridge.agent.distribution.name>
683+
<python.cli.distribution.name>apache-stratos-python-cli</python.cli.distribution.name>
683684

684685
<!-- Maven plugin versions -->
685686
<maven.incremental.plugin.version>1.3</maven.incremental.plugin.version>

products/pom.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
<modules>
3636
<module>python-cartridge-agent</module>
3737
<module>cartridge-agent</module>
38+
<module>python-cli</module>
3839
<module>stratos-cli</module>
3940
<module>load-balancer</module>
4041
<module>stratos</module>
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
<?xml version="1.0" encoding="ISO-8859-1"?>
2+
<!--
3+
~ Licensed to the Apache Software Foundation (ASF) under one
4+
~ or more contributor license agreements. See the NOTICE file
5+
~ distributed with this work for additional information
6+
~ regarding copyright ownership. The ASF licenses this file
7+
~ to you under the Apache License, Version 2.0 (the
8+
~ "License"); you may not use this file except in compliance
9+
~ with the License. You may obtain a copy of the License at
10+
~
11+
~ http://www.apache.org/licenses/LICENSE-2.0
12+
~
13+
~ Unless required by applicable law or agreed to in writing,
14+
~ software distributed under the License is distributed on an
15+
~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16+
~ KIND, either express or implied. See the License for the
17+
~ specific language governing permissions and limitations
18+
~ under the License.
19+
-->
20+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
21+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
22+
<modelVersion>4.0.0</modelVersion>
23+
<parent>
24+
<groupId>org.apache.stratos</groupId>
25+
<artifactId>apache-stratos-python-cli-parent</artifactId>
26+
<version>4.1.4-SNAPSHOT</version>
27+
<relativePath>../../pom.xml</relativePath>
28+
</parent>
29+
30+
<artifactId>python-cli-distribution</artifactId>
31+
<packaging>pom</packaging>
32+
<name>Apache Stratos - Python CLI</name>
33+
<description>Apache Stratos Python CLI Distribution</description>
34+
35+
<build>
36+
<plugins>
37+
<plugin>
38+
<groupId>org.apache.maven.plugins</groupId>
39+
<artifactId>maven-assembly-plugin</artifactId>
40+
<executions>
41+
<execution>
42+
<id>1-pre_dist</id>
43+
<phase>test</phase>
44+
<goals>
45+
<goal>attached</goal>
46+
</goals>
47+
<configuration>
48+
<finalName>${python.cli.distribution.name}-${project.version}</finalName>
49+
<descriptors>
50+
<descriptor>src/main/assembly/bin.xml</descriptor>
51+
</descriptors>
52+
<appendAssemblyId>false</appendAssemblyId>
53+
</configuration>
54+
</execution>
55+
</executions>
56+
</plugin>
57+
</plugins>
58+
</build>
59+
</project>
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
~ Licensed to the Apache Software Foundation (ASF) under one
4+
~ or more contributor license agreements. See the NOTICE file
5+
~ distributed with this work for additional information
6+
~ regarding copyright ownership. The ASF licenses this file
7+
~ to you under the Apache License, Version 2.0 (the
8+
~ "License"); you may not use this file except in compliance
9+
~ with the License. You may obtain a copy of the License at
10+
~
11+
~ http://www.apache.org/licenses/LICENSE-2.0
12+
~
13+
~ Unless required by applicable law or agreed to in writing,
14+
~ software distributed under the License is distributed on an
15+
~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16+
~ KIND, either express or implied. See the License for the
17+
~ specific language governing permissions and limitations
18+
~ under the License.
19+
-->
20+
<assembly>
21+
<id>bin</id>
22+
<formats>
23+
<format>zip</format>
24+
</formats>
25+
<fileSets>
26+
<fileSet>
27+
<directory>
28+
${project.basedir}/../../../../components/org.apache.stratos.python.cli/src/main/python/cli
29+
</directory>
30+
<outputDirectory>.</outputDirectory>
31+
<includes>
32+
<include>**/*</include>
33+
</includes>
34+
<excludes>
35+
<exclude>**/*.pyc</exclude>
36+
</excludes>
37+
<fileMode>0755</fileMode>
38+
</fileSet>
39+
</fileSets>
40+
<files>
41+
<file>
42+
<source>${project.basedir}/src/main/notice/NOTICE</source>
43+
<outputDirectory>/</outputDirectory>
44+
<filtered>true</filtered>
45+
<fileMode>644</fileMode>
46+
</file>
47+
<file>
48+
<source>${project.basedir}/src/main/license/LICENSE</source>
49+
<outputDirectory>/</outputDirectory>
50+
<filtered>true</filtered>
51+
<fileMode>644</fileMode>
52+
</file>
53+
<file>
54+
<source>${project.basedir}/src/main/readme/README</source>
55+
<outputDirectory>/</outputDirectory>
56+
<filtered>true</filtered>
57+
<fileMode>644</fileMode>
58+
</file>
59+
</files>
60+
</assembly>

0 commit comments

Comments
 (0)