This file is indexed.

/usr/share/pyshared/juju/control/unexpose.py is in juju-0.7 0.7-0ubuntu2.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
"""Implementation of unexpose subcommand"""

from twisted.internet.defer import inlineCallbacks

from juju.control.utils import get_environment
from juju.state.service import ServiceStateManager


def configure_subparser(subparsers):
    """Configure unexpose subcommand"""
    sub_parser = subparsers.add_parser("unexpose", help=command.__doc__)
    sub_parser.add_argument(
        "--environment", "-e",
        help="juju environment to operate in.")
    sub_parser.add_argument(
        "service_name",
        help="Name of the service that should be unexposed.")
    return sub_parser


def command(options):
    """Remove internet access to a service."""
    environment = get_environment(options)
    return unexpose(
        options.environments,
        environment,
        options.verbose,
        options.log,
        options.service_name)


@inlineCallbacks
def unexpose(
    config, environment, verbose, log, service_name):
    """Unexpose a service."""
    provider = environment.get_machine_provider()
    client = yield provider.connect()
    try:
        service_manager = ServiceStateManager(client)
        service_state = yield service_manager.get_service_state(service_name)
        already_exposed = yield service_state.get_exposed_flag()
        if already_exposed:
            yield service_state.clear_exposed_flag()
            log.info("Service %r was unexposed.", service_name)
        else:
            log.info("Service %r was not exposed.", service_name)
    finally:
        yield client.close()