summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2015-12-04 14:48:47 +0000
committerGerrit Code Review <review@openstack.org>2015-12-04 14:48:47 +0000
commit6c634693abf5c7a3583debbf86b1f1d1a5ade89d (patch)
tree64993f2ee14d69494cd85115669fb7af28a132b4
parent3f45d44c143e9dfc60784246bc279d0152675e56 (diff)
parent004aa9bdb8599a5edfd876f510aa437daa9d7245 (diff)
downloadpython-saharaclient-6c634693abf5c7a3583debbf86b1f1d1a5ade89d.tar.gz
Merge "Adding indications of results after delete operations"
-rw-r--r--saharaclient/osc/v1/cluster_templates.py4
-rw-r--r--saharaclient/osc/v1/clusters.py23
-rw-r--r--saharaclient/osc/v1/data_sources.py5
-rw-r--r--saharaclient/osc/v1/images.py5
-rw-r--r--saharaclient/osc/v1/job_binaries.py7
-rw-r--r--saharaclient/osc/v1/job_templates.py5
-rw-r--r--saharaclient/osc/v1/job_types.py9
-rw-r--r--saharaclient/osc/v1/jobs.py14
-rw-r--r--saharaclient/osc/v1/node_group_templates.py4
-rw-r--r--saharaclient/osc/v1/plugins.py9
10 files changed, 70 insertions, 15 deletions
diff --git a/saharaclient/osc/v1/cluster_templates.py b/saharaclient/osc/v1/cluster_templates.py
index b1fdbdc..aa053a6 100644
--- a/saharaclient/osc/v1/cluster_templates.py
+++ b/saharaclient/osc/v1/cluster_templates.py
@@ -14,6 +14,7 @@
# limitations under the License.
import json
+import sys
from cliff import command
from cliff import lister
@@ -323,6 +324,9 @@ class DeleteClusterTemplate(command.Command):
for ct in parsed_args.cluster_template:
ct_id = utils.get_resource_id(client.cluster_templates, ct)
client.cluster_templates.delete(ct_id)
+ sys.stdout.write(
+ 'Cluster template "{ct}" has been removed '
+ 'successfully.\n'.format(ct=ct))
class UpdateClusterTemplate(show.ShowOne):
diff --git a/saharaclient/osc/v1/clusters.py b/saharaclient/osc/v1/clusters.py
index b5c4cfd..74af6ce 100644
--- a/saharaclient/osc/v1/clusters.py
+++ b/saharaclient/osc/v1/clusters.py
@@ -14,6 +14,7 @@
# limitations under the License.
import json
+import sys
from cliff import command
from cliff import lister
@@ -191,7 +192,7 @@ class CreateCluster(show.ShowOne):
if not osc_utils.wait_for_status(
client.clusters.get, cluster.id):
self.log.error(
- 'Error occurred during cluster creation: %s',
+ 'Error occurred during cluster creation: %s' %
data['id'])
data = {}
@@ -203,7 +204,7 @@ class CreateCluster(show.ShowOne):
if not osc_utils.wait_for_status(
client.clusters.get, data['id']):
self.log.error(
- 'Error occurred during cluster creation: %s',
+ 'Error occurred during cluster creation: %s' %
data['id'])
data = client.clusters.get(data['id']).to_dict()
_format_cluster_output(data)
@@ -339,13 +340,20 @@ class DeleteCluster(command.Command):
cluster_id = utils.get_resource_id(
client.clusters, cluster)
client.clusters.delete(cluster_id)
- clusters.append(cluster_id)
+ clusters.append((cluster_id, cluster))
+ sys.stdout.write(
+ 'Cluster "{cluster}" deletion has been started.\n'.format(
+ cluster=cluster))
if parsed_args.wait:
- for cluster_id in clusters:
+ for cluster_id, cluster_arg in clusters:
if not utils.wait_for_delete(client.clusters, cluster_id):
self.log.error(
- 'Error occurred during cluster deleting: %s',
+ 'Error occurred during cluster deleting: %s' %
cluster_id)
+ else:
+ sys.stdout.write(
+ 'Cluster "{cluster}" has been removed '
+ 'successfully.\n'.format(cluster=cluster_arg))
class UpdateCluster(show.ShowOne):
@@ -521,11 +529,14 @@ class ScaleCluster(show.ShowOne):
data = client.clusters.scale(cluster.id, scale_object).cluster
+ sys.stdout.write(
+ 'Cluster "{cluster}" scaling has been started.\n'.format(
+ cluster=parsed_args.cluster))
if parsed_args.wait:
if not osc_utils.wait_for_status(
client.clusters.get, data['id']):
self.log.error(
- 'Error occurred during cluster scaling: %s',
+ 'Error occurred during cluster scaling: %s' %
cluster.id)
data = client.clusters.get(cluster.id).to_dict()
diff --git a/saharaclient/osc/v1/data_sources.py b/saharaclient/osc/v1/data_sources.py
index 3ba6f06..ce6bcc2 100644
--- a/saharaclient/osc/v1/data_sources.py
+++ b/saharaclient/osc/v1/data_sources.py
@@ -13,6 +13,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
+import sys
+
from cliff import command
from cliff import lister
from cliff import show
@@ -196,6 +198,9 @@ class DeleteDataSource(command.Command):
data_source_id = utils.get_resource_id(
client.data_sources, ds)
client.data_sources.delete(data_source_id)
+ sys.stdout.write(
+ 'Data Source "{ds}" has been removed '
+ 'successfully.\n'.format(ds=ds))
class UpdateDataSource(show.ShowOne):
diff --git a/saharaclient/osc/v1/images.py b/saharaclient/osc/v1/images.py
index f01d247..4031221 100644
--- a/saharaclient/osc/v1/images.py
+++ b/saharaclient/osc/v1/images.py
@@ -13,6 +13,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
+import sys
+
from cliff import command
from cliff import lister
from cliff import show
@@ -185,6 +187,9 @@ class UnregisterImage(command.Command):
for image in parsed_args.image:
image_id = utils.get_resource_id(client.images, image)
client.images.unregister_image(image_id)
+ sys.stdout.write(
+ 'Image "{image}" has been unregistered '
+ 'successfully.\n'.format(image=image))
class SetImageTags(show.ShowOne):
diff --git a/saharaclient/osc/v1/job_binaries.py b/saharaclient/osc/v1/job_binaries.py
index 9272c2e..9751fdf 100644
--- a/saharaclient/osc/v1/job_binaries.py
+++ b/saharaclient/osc/v1/job_binaries.py
@@ -14,6 +14,7 @@
# limitations under the License.
from os import path
+import sys
from cliff import command
from cliff import lister
@@ -258,6 +259,9 @@ class DeleteJobBinary(command.Command):
if not ex.error_code == '404':
raise
client.job_binaries.delete(jb.id)
+ sys.stdout.write(
+ 'Job binary "{jb}" has been removed '
+ 'successfully.\n'.format(jb=jb))
class UpdateJobBinary(show.ShowOne):
@@ -422,3 +426,6 @@ class DownloadJobBinary(command.Command):
else:
with open(parsed_args.file, 'w') as f:
f.write(data)
+ sys.stdout.write(
+ 'Job binary "{jb}" has been downloaded '
+ 'successfully.\n'.format(jb=parsed_args.job_binary))
diff --git a/saharaclient/osc/v1/job_templates.py b/saharaclient/osc/v1/job_templates.py
index 2ab21d6..ce8d77e 100644
--- a/saharaclient/osc/v1/job_templates.py
+++ b/saharaclient/osc/v1/job_templates.py
@@ -13,6 +13,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
+import sys
+
from cliff import command
from cliff import lister
from cliff import show
@@ -245,6 +247,9 @@ class DeleteJobTemplate(command.Command):
for jt in parsed_args.job_template:
jt_id = utils.get_resource_id(client.jobs, jt)
client.jobs.delete(jt_id)
+ sys.stdout.write(
+ 'Job template "{jt}" has been removed '
+ 'successfully.\n'.format(jt=jt))
class UpdateJobTemplate(show.ShowOne):
diff --git a/saharaclient/osc/v1/job_types.py b/saharaclient/osc/v1/job_types.py
index ca483b8..4f98791 100644
--- a/saharaclient/osc/v1/job_types.py
+++ b/saharaclient/osc/v1/job_types.py
@@ -14,6 +14,7 @@
# limitations under the License.
from os import path
+import sys
from cliff import command
from cliff import lister
@@ -127,7 +128,7 @@ class GetJobTypeConfigs(command.Command):
else:
with open(parsed_args.file, 'w') as f:
jsonutils.dump(data, f, indent=4)
- self.log.info(
- '"%(type)s" job configs were saved in "%(file)s"'
- 'file' % {'type': parsed_args.job_type,
- 'file': parsed_args.file})
+ sys.stdout.write(
+ '"%(type)s" job configs were saved in "%(file)s"'
+ 'file' % {'type': parsed_args.job_type,
+ 'file': parsed_args.file})
diff --git a/saharaclient/osc/v1/jobs.py b/saharaclient/osc/v1/jobs.py
index 94223bd..a232c1f 100644
--- a/saharaclient/osc/v1/jobs.py
+++ b/saharaclient/osc/v1/jobs.py
@@ -13,6 +13,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
+import sys
+
from cliff import command
from cliff import lister
from cliff import show
@@ -186,6 +188,10 @@ class ExecuteJob(show.ShowOne):
configs=job_configs, is_public=parsed_args.public,
is_protected=parsed_args.protected).to_dict()
+ sys.stdout.write(
+ 'Job "{job}" has been started successfully.\n'.format(
+ job=data['id']))
+
_format_job_output(data)
data = utils.prepare_data(data, JOB_FIELDS)
@@ -299,13 +305,19 @@ class DeleteJob(command.Command):
client = self.app.client_manager.data_processing
for job_id in parsed_args.job:
client.job_executions.delete(job_id)
+ sys.stdout.write(
+ 'Job "{job}" deletion has been started.\n'.format(job=job_id))
if parsed_args.wait:
for job_id in parsed_args.job:
if not utils.wait_for_delete(client.job_executions, job_id):
self.log.error(
- 'Error occurred during job deleting: %s',
+ 'Error occurred during job deleting: %s' %
job_id)
+ else:
+ sys.stdout.write(
+ 'Job "{job}" has been removed successfully.\n'.format(
+ job=job_id))
class UpdateJob(show.ShowOne):
diff --git a/saharaclient/osc/v1/node_group_templates.py b/saharaclient/osc/v1/node_group_templates.py
index 6ad7985..c86c76d 100644
--- a/saharaclient/osc/v1/node_group_templates.py
+++ b/saharaclient/osc/v1/node_group_templates.py
@@ -14,6 +14,7 @@
# limitations under the License.
import json
+import sys
from cliff import command
from cliff import lister
@@ -400,6 +401,9 @@ class DeleteNodeGroupTemplate(command.Command):
ngt_id = utils.get_resource_id(
client.node_group_templates, ngt)
client.node_group_templates.delete(ngt_id)
+ sys.stdout.write(
+ 'Node group template "{ngt}" has been removed '
+ 'successfully.\n'.format(ngt=ngt))
class UpdateNodeGroupTemplate(show.ShowOne):
diff --git a/saharaclient/osc/v1/plugins.py b/saharaclient/osc/v1/plugins.py
index 9b67016..e616a35 100644
--- a/saharaclient/osc/v1/plugins.py
+++ b/saharaclient/osc/v1/plugins.py
@@ -14,6 +14,7 @@
# limitations under the License.
from os import path
+import sys
from cliff import command
from cliff import lister
@@ -155,7 +156,7 @@ class GetPluginConfigs(command.Command):
else:
with open(parsed_args.file, 'w') as f:
jsonutils.dump(data, f, indent=4)
- self.log.info(
- '"%(plugin)s" plugin configs was saved in "%(file)s"'
- 'file' % {'plugin': parsed_args.plugin,
- 'file': parsed_args.file})
+ sys.stdout.write(
+ '"%(plugin)s" plugin configs was saved in "%(file)s"'
+ 'file' % {'plugin': parsed_args.plugin,
+ 'file': parsed_args.file})