def __init__(self, cluster_name=None, role_name=None): if cluster_name: self.cluster_name = cluster_name if role_name: self.role_name = role_name self.cfg = config.get_role_config(cluster_name, role_name) else: self.cfg = config.get_cluster_config(cluster_name) else: self.cfg = _cfg.get_root() self.conn = util.deploy_conn()
def get_deployment_group_name(self, group_arg): group_name = group_arg # default to using arg as deploymentgroup name # check to see if group_arg is a valid deploymentegroup name or valid cluster/role dep = deploy.Deploy() groups = dep.get_groups() group_names = groups['deploymentGroups'] if group_name not in group_names: # not valid deployment group name # look in config for group name from cluster/role cluster,role = self.get_cluster_and_role_from_args(group_arg, quiet=True) if role: cfg = config.get_role_config(cluster, role) group_name = cfg.get('deployment_group') if not group_name: print("Failed to find DeploymentGroup name in configuration for role {}".format(role)) return None else: print("Invalid DeploymentGroup name '{}' and no deployment_group is configured for this role.".format(group_arg)) return None return group_name
def __init__(self, cluster_name, role_name): self.cluster_name = cluster_name self.role_name = role_name self.role_config = config.get_role_config(cluster_name, role_name) self.conn = util.as_conn()