def test_template_options(self): ctx = click.Context(core.cli) path = os.path.join(testing.FIXTURE_PATH, 'sample_vs_template.conf') template.TemplateCallback(list_args=['disk'])(ctx, None, path) self.assertEqual( ctx.default_map, { 'cpu': '4', 'datacenter': 'dal05', 'domain': 'example.com', 'hostname': 'myhost', 'hourly': 'true', 'memory': '1024', 'monthly': 'false', 'network': '100', 'os': 'DEBIAN_7_64', 'disk': ['50', '100'], })
@helpers.multi_option('--key', '-k', help="SSH keys to add to the root user") @helpers.multi_option('--disk', help="Disk sizes") @click.option('--private', is_flag=True, help="Forces the VS to only have access the private network") @click.option('--like', is_eager=True, callback=_update_with_like_args, help="Use the configuration from an existing VS") @click.option('--network', '-n', help="Network port speed in Mbps") @helpers.multi_option('--tag', '-g', help="Tags to add to the instance") @click.option( '--template', '-t', is_eager=True, callback=template.TemplateCallback(list_args=['disk', 'key', 'tag']), help="A template file that defaults the command-line options", type=click.Path(exists=True, readable=True, resolve_path=True)) @click.option('--userdata', '-u', help="User defined metadata string") @click.option('--userfile', '-F', type=click.Path(exists=True, readable=True, resolve_path=True), help="Read userdata from file") @click.option( '--vlan-public', type=click.INT, help="The ID of the public VLAN on which you want the virtual server placed" ) @click.option( '--vlan-private', type=click.INT,
def test_no_template_option(self): ctx = click.Context(core.cli) template.TemplateCallback()(ctx, None, None) self.assertIsNone(ctx.default_map)
'-f', help="Dedicated Virtual Host flavor", required=True, prompt=True) @click.option('--billing', type=click.Choice(['hourly', 'monthly']), default='hourly', show_default=True, help="Billing rate") @click.option('--verify', is_flag=True, help="Verify dedicatedhost without creating it.") @click.option('--template', '-t', is_eager=True, callback=template.TemplateCallback(list_args=['key']), help="A template file that defaults the command-line options", type=click.Path(exists=True, readable=True, resolve_path=True)) @click.option('--export', type=click.Path(writable=True, resolve_path=True), help="Exports options to a template file") @environment.pass_env def cli(env, **kwargs): """Order/create a dedicated host.""" mgr = SoftLayer.DedicatedHostManager(env.client) order = { 'hostname': kwargs['hostname'], 'domain': kwargs['domain'], 'flavor': kwargs['flavor'], 'location': kwargs['datacenter'],