Skip to content

Commit

Permalink
Add check for empty template
Browse files Browse the repository at this point in the history
  • Loading branch information
0lvin committed Jan 19, 2018
1 parent 850867e commit 938b9b5
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions cloudify_azure/resources/deployment.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import json

from cloudify import exceptions as cfy_exc
from cloudify.decorators import operation

from azure.common.credentials import ServicePrincipalCredentials
from azure.mgmt.resource import ResourceManagementClient
from azure.mgmt.resource.resources.models import DeploymentMode
Expand Down Expand Up @@ -91,11 +94,16 @@ def create(ctx, **kwargs):

# load template
template = properties.get('template')
if not template:
if not template and properties.get('template_file'):
ctx.logger.info("Will be used {} as template"
.format(repr(properties.get('template_file'))))
.format(repr(properties['template_file'])))
template = ctx.get_resource(properties['template_file'])

if not template:
raise cfy_exc.NonRecoverableError(
"please check your credentials"
)

# create deployment
deployment.create(template=template,
params=properties.get('params', {}),
Expand Down

0 comments on commit 938b9b5

Please sign in to comment.