Code Duplication    Length = 20-24 lines in 2 locations

isomer/tool/instance.py 2 locations

@@ 137-160 (lines=24) @@
134
    finish(ctx)
135
136
137
@instance.command(
138
    name="check", short_help="check instance configuration and environments"
139
)
140
@click.pass_context
141
def check_instance(ctx):
142
    """Check health of the selected instance"""
143
144
    instance_name = ctx.obj["instance"]
145
    instances = ctx.obj["instances"]
146
    instance_configuration = instances[instance_name]
147
148
    environment_name = instance_configuration["environment"]
149
    environment_config = instance_configuration["environments"][environment_name]
150
151
    if instance_name not in instances:
152
        log("Instance %s unknown!" % instance_name, lvl=warn)
153
        abort(EXIT_INSTANCE_UNKNOWN)
154
155
    # TODO: Validate instance config
156
157
    _check_environment(ctx, "blue")
158
    _check_environment(ctx, "green")
159
160
    finish(ctx)
161
162
163
@instance.command(name="browser", short_help="try to point a browser to this instance")
@@ 115-134 (lines=20) @@
112
    _get_configuration(ctx)
113
114
115
@instance.command(name="info", short_help="show system configuration of instance")
116
@click.pass_context
117
def info_instance(ctx):
118
    """Print information about the selected instance"""
119
120
    instance_name = ctx.obj["instance"]
121
    instances = ctx.obj["instances"]
122
    instance_configuration = instances[instance_name]
123
124
    environment_name = instance_configuration["environment"]
125
    environment_config = instance_configuration["environments"][environment_name]
126
127
    if instance_name not in instances:
128
        log("Instance %s unknown!" % instance_name, lvl=warn)
129
        abort(EXIT_INSTANCE_UNKNOWN)
130
131
    log("Instance configuration:", instance_configuration, pretty=True)
132
    log("Active environment (%s):" % environment_name, environment_config, pretty=True)
133
134
    finish(ctx)
135
136
137
@instance.command(