Skip to content

Commit

Permalink
Added setting to add vcenter url as param and fixed a bug created due…
Browse files Browse the repository at this point in the history
… to default_template_path in config
  • Loading branch information
Sumit Murari committed Jul 5, 2017
1 parent f27ca42 commit 59c9afb
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 7 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,13 @@ This example would run /usr/local/bin/additional-provisioning-steps.sh on the sa
##### Clone a template and put vm is specific folder

```
ezmomi clone --template centos67 --hostname test01 --cpus 2 --mem 4 --destination-folder "/DC/folder/" --ips 172.10.16.203 172.10.16.204
ezmomi clone --server vcenter_url --template centos67 --hostname test01 --cpus 2 --mem 4 --destination-folder "/DC/folder/" --ips 172.10.16.203 172.10.16.204
```

This ^ example will put the cloned vm to specific destination folder
This example will put the cloned vm to specific destination folder in specified vcenter.


##### Power Operations
##### Power Operations

Guest shutdown

Expand Down
1 change: 0 additions & 1 deletion ezmomi/config/config.yml.example
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ password: "mypass#123"
cpus: 1
mem: 3

default_templates_path: "Specific_folder_for_the_template_This_is_option_like_/DC/folder1/folder2" #Optional
template: centos65
domain: example

Expand Down
5 changes: 2 additions & 3 deletions ezmomi/ezmomi.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,6 @@ def clone(self):
self.config['hostname'] = self.config['hostname'].lower()
self.config['mem'] = int(self.config['mem'] * 1024) # convert GB to MB

template_path = self.config['default_templates_path']
print "Cloning %s to new host %s with %sMB RAM..." % (
self.config['template'],
self.config['hostname'],
Expand Down Expand Up @@ -255,12 +254,12 @@ def clone(self):
% ip_settings[0]['datastore']
sys.exit(1)

if template_path:
if self.config['template_folder']:
template_vm = self.get_vm_failfast(
self.config['template'],
False,
'Template VM',
path=template_path
path=self.config['template_folder']
)
else:
template_vm = self.get_vm_failfast(
Expand Down
12 changes: 12 additions & 0 deletions ezmomi/params.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,12 @@ def arg_setup():
help="Set this flag to disable ssl verification"
)

common_parser.add_argument(
"--server",
required=False,
help="vsphere server to connect to."
)

# list
list_parser = subparsers.add_parser(
"list",
Expand Down Expand Up @@ -178,6 +184,12 @@ def arg_setup():
type=str,
help="VM template name to clone from"
)
clone_parser.add_argument(
"--template-folder",
type=str,
default="",
help="Folder to pull templates from"
)
clone_parser.add_argument(
"--host",
required=False,
Expand Down

0 comments on commit 59c9afb

Please sign in to comment.