Added supported_formats

We allow outputs to be in YAML or JSON formats.
This commit is contained in:
tengqm
2015-01-05 19:52:14 +08:00
parent f3e30679ed
commit 3f19f54d4a

View File

@@ -13,7 +13,9 @@
# License for the specific language governing permissions and limitations
# under the License.
import yaml
from oslo.serialization import jsonutils
from oslo.utils import importutils
from senlinclient.openstack.common import cliutils
@@ -26,6 +28,11 @@ env = cliutils.env
print_list = cliutils.print_list
exit = cliutils.exit
supported_formats = {
"json": lambda x: jsonutils.dumps(x, indent=2),
"yaml": yaml.safe_dump
}
def import_versioned_module(version, submodule=None):
module = 'senlinclient.v%s' % version