Align fuel2 network-template upload procedure

* removes extra '.yaml' extension from filename
* makes -f/--file option required

Change-Id: If1bfe4d9f68331f76ca748281cbc1f609959573d
Closes-Bug: 1632316
This commit is contained in:
tivaliy 2016-10-11 23:21:25 +03:00
parent 14e8bee51b
commit c78c6624b6
3 changed files with 6 additions and 7 deletions

View File

@ -39,6 +39,7 @@ class NetworkTemplateMixin(object):
def add_file_argument(parser):
parser.add_argument(
'-f', '--file',
required=True,
type=str,
help='Yaml file containing the network template'
)

View File

@ -20,13 +20,12 @@ from fuelclient.tests.unit.v2.cli import test_engine
class TestNetworkTemplateCommand(test_engine.BaseCLITest):
def test_network_template_upload(self):
@mock.patch('sys.stderr')
def test_network_template_upload_fail(self, mocked_stderr):
args = 'network-template upload 1'
self.exec_command(args)
self.m_get_client.assert_called_once_with('environment', mock.ANY)
self.m_client.upload_network_template.assert_called_once_with(
1, None)
self.assertRaises(SystemExit, self.exec_command, args)
self.assertIn('--file',
mocked_stderr.write.call_args_list[-1][0][0])
def test_network_template_upload_w_file(self):
args = 'network-template upload --file /tmp/test-file 1'

View File

@ -125,7 +125,6 @@ class EnvironmentClient(base_v1.BaseV1Client):
file_path=file_path)
env.set_network_template_data(network_template_data)
file_path = env.serializer.prepare_path(file_path)
return file_path
def download_network_template(self, environment_id, directory=None):