Skip to content

Commit c2d5abc

Browse files
author
EarthmanT
committed
build rhel step 1
1 parent b9b2a97 commit c2d5abc

File tree

4 files changed

+27
-7
lines changed

4 files changed

+27
-7
lines changed

cloudify_vcd/legacy/utils.py

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414

1515
import ipaddress
1616
from copy import deepcopy
17+
from tempfile import NamedTemporaryFile
1718

1819
from ..utils import (
1920
find_rels_by_type,
@@ -23,10 +24,13 @@
2324
from vcd_plugin_sdk.connection import VCloudConnect
2425
from vcd_plugin_sdk.resources.network import VCloudNetwork, VCloudGateway
2526

27+
from cloudify import ctx as ctx_from_import
2628
from cloudify.exceptions import NonRecoverableError
2729
from cloudify_common_sdk.utils import (
2830
get_ctx_node,
29-
get_ctx_instance)
31+
get_ctx_instance,
32+
get_deployment_dir
33+
)
3034

3135

3236
OLD_NETWORK_KEYS = [
@@ -95,6 +99,11 @@ def get_vcloud_cx(client_config, logger):
9599
new_client_config['verify_ssl_certs'] = client_config.pop(
96100
'verify_ssl_certs')
97101

102+
if 'log_file' not in new_client_config:
103+
new_temp = NamedTemporaryFile(
104+
dir=get_deployment_dir(ctx_from_import.deployment.id))
105+
new_client_config['log_file'] = new_temp.name
106+
98107
# TODO: Figure out what to do with the rest of the stuff in client_config.
99108
return VCloudConnect(logger, new_client_config, credentials)
100109

@@ -248,8 +257,10 @@ def convert_network_config(config):
248257

249258
if 'ip_range_start' not in config or 'ip_range_end' not in config:
250259
ip_range_start, ip_range_end = get_ip_range(config)
251-
config['ip_range_start'] = ip_range_start.compressed
252-
config['ip_range_end'] = ip_range_end.compressed
260+
if ip_range_start:
261+
config['ip_range_start'] = ip_range_start.compressed
262+
if ip_range_end:
263+
config['ip_range_end'] = ip_range_end.compressed
253264

254265
if 'dns' in config:
255266
primary_ip, secondary_ip = get_dns_ips(config['dns'])
@@ -309,6 +320,10 @@ def get_network_cidr(config):
309320
netmask = ipaddress.IPv4Address('0.0.0.0/{}'.format(netmask))
310321
if gateway_ip:
311322
start = gateway_ip
323+
ctx_from_import.logger.info(
324+
'Using these IPs for CIDR: {} {}'.format(start, end))
325+
if not start or not end:
326+
return None
312327
ip_range = [addr for addr in ipaddress.summarize_address_range(start, end)]
313328
if len(ip_range) >= 1:
314329
if netmask:

plugin.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
plugins:
22

3-
vcd:
3+
vcd: &plugin_mapping
44
executor: central_deployment_agent
55
package_name: cloudify-vcloud-plugin
66
package_version: '2.0.2'
7+
# legacy
8+
vcloud: *plugin_mapping
79

810
data_types:
911

setup.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,9 @@ def get_version(rel_file='plugin.yaml'):
4343
'vcloud_network_plugin',
4444
'vcloud_server_plugin',
4545
'cloudify_vcd',
46+
'cloudify_vcd.legacy',
47+
'cloudify_vcd.legacy.compute',
48+
'cloudify_vcd.legacy.network',
4649
'vcd_plugin_sdk',
4750
'vcd_plugin_sdk.resources',
4851
],

vcd_plugin_sdk/connection.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@ def default_logger(stream=sys.stdout):
2626

2727
logging.basicConfig(
2828
# stream=stream,
29-
filename=os.path.join(
30-
os.path.expanduser('~'),
31-
'Desktop', 'vcloudclient.log'),
29+
# filename=os.path.join(
30+
# os.path.expanduser('~'),
31+
# 'Desktop', 'vcloudclient.log'),
3232
level=logging.INFO,
3333
format='%(asctime)s - %(name)s - %(levelname)s - %(message)s',
3434
datefmt='%y.%m.%d-%H:%M:%S')

0 commit comments

Comments
 (0)