Adding -dev docker image. Tweak msgs. Fix for posix shell.

This commit is contained in:
Jon Gallant 2018-02-09 21:49:46 -08:00
Родитель ed4d3b9c67
Коммит b5f8fc693d
10 изменённых файлов: 39 добавлений и 11 удалений

Просмотреть файл

@ -71,7 +71,7 @@ Please see [Azure IoT Edge Dev Resources](https://github.com/jonbgallant/azure-i
#### Automated Setup
You can use the **Azure IoT Edge Dev Tool** to create a new IoT Hub and a new Edge device. This command will also print the corresponding connection strings
You can use the **Azure IoT Edge Dev Tool** to create a new IoT Hub and a new Edge device. This command will also print the corresponding connection strings:
```
iotedgedev azure --setup
--credentials USERNAME PASSWORD

Просмотреть файл

@ -0,0 +1,6 @@
FROM jongallant/iotedgedev:${VERSION}-linux
RUN apt-get update && apt-get install -y python-dev build-essential libssl-dev libffi-dev libxml2-dev libxslt1-dev zlib1g-dev python-pip
COPY install-dev.sh /scripts/install-dev.sh
RUN chmod +x /scripts/install-dev.sh

Просмотреть файл

@ -0,0 +1,6 @@
FROM jongallant/iotedgedev:0.61.0-linux
RUN apt-get update && apt-get install -y python-dev build-essential libssl-dev libffi-dev libxml2-dev libxslt1-dev zlib1g-dev python-pip
COPY install-dev.sh /scripts/install-dev.sh
RUN chmod +x /scripts/install-dev.sh

Просмотреть файл

@ -1,2 +1,2 @@
FROM jongallant/iotedgedev-deps:0.58.0-linux
FROM jongallant/iotedgedev-deps:0.61.0-linux
RUN pip install -U azure-iot-edge-dev-tool

Просмотреть файл

@ -1,4 +1,6 @@
export VERSION=$1
docker build -f Dockerfile.deps -t jongallant/iotedgedev-deps:$1 -t jongallant/iotedgedev-deps:$1-linux -t jongallant/iotedgedev-deps:latest -t jongallant/iotedgedev-deps:latest-linux .
cat Dockerfile | envsubst > Dockerfile.expanded
docker build -f Dockerfile.expanded -t jongallant/iotedgedev:$1 -t jongallant/iotedgedev:$1-linux -t jongallant/iotedgedev:latest -t jongallant/iotedgedev:latest-linux .
docker build -f Dockerfile.expanded -t jongallant/iotedgedev:$1 -t jongallant/iotedgedev:$1-linux -t jongallant/iotedgedev:latest -t jongallant/iotedgedev:latest-linux .
cat Dockerfile.dev | envsubst > Dockerfile.dev.expanded
docker build -f Dockerfile.dev.expanded -t jongallant/iotedgedev-dev:$1 -t jongallant/iotedgedev-dev:$1-linux -t jongallant/iotedgedev-dev:latest -t jongallant/iotedgedev-dev:latest-linux .

Просмотреть файл

@ -0,0 +1,5 @@
#!/bin/sh
cd /home/tool
pip install -r requirements_dev.txt
pip install -e .
cd /home

Просмотреть файл

@ -4,6 +4,10 @@ docker push jongallant/iotedgedev-deps:$1
docker push jongallant/iotedgedev-deps:$1-linux
docker push jongallant/iotedgedev-deps:latest
docker push jongallant/iotedgedev-deps:latest-linux
docker push jongallant/iotedgedev-dev:$1
docker push jongallant/iotedgedev-dev:$1-linux
docker push jongallant/iotedgedev-dev:latest
docker push jongallant/iotedgedev-dev:latest-linux
docker push jongallant/iotedgedev:$1
docker push jongallant/iotedgedev:$1-linux
docker push jongallant/iotedgedev:latest

2
docker/linux/run-dev.sh Normal file
Просмотреть файл

@ -0,0 +1,2 @@
#!/bin/bash
docker run -it -v /var/run/docker.sock:/var/run/docker.sock -v c:/temp/edgeprojects:/home jongallant/iotedgedev-dev:$1-linux

Просмотреть файл

@ -10,6 +10,7 @@ output_io_cls = StringIO
from azure.cli.core import get_default_cli
from .envvars import EnvVars
class AzureCli:
def __init__(self, output, envvars, cli=get_default_cli()):
self.output = output
@ -32,7 +33,7 @@ class AzureCli:
try:
if stdout_io or stderr_io:
process = subprocess.Popen(self.prepare_az_cli_args(
args), stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
args), stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=not self.envvars.is_posix())
stdout_data, stderr_data = process.communicate()
if stdout_io and stdout_data != "":
stdout_io.writelines(self.decode(stdout_data))
@ -40,7 +41,7 @@ class AzureCli:
stderr_io.writelines(self.decode(stderr_data))
else:
process = subprocess.Popen(
self.prepare_az_cli_args(args), shell=True)
self.prepare_az_cli_args(args), shell=not self.envvars.is_posix())
process.communicate()
if process.returncode != 0:
@ -197,7 +198,7 @@ class AzureCli:
for iot in data:
if iot["sku"]["name"] == "F1":
return (iot["name"], iot["resourceGroup"])
return None
return (None, None)
def list_iot_hubs(self, resource_group):
self.output.header(
@ -226,7 +227,8 @@ class AzureCli:
with output_io_cls() as io:
with output_io_cls() as error_io:
self.output.prompt("Creating IoT Hub please wait...")
self.output.prompt(
"Creating IoT Hub. Please wait as this could take a few minutes to complete...")
result = self.invoke_az_cli_outproc(["iot", "hub", "create", "--name", value, "--resource-group",
resource_group, "--sku", sku, "--out", "table"],

Просмотреть файл

@ -119,11 +119,11 @@ def validate_option(ctx, param, value):
if envvars.IOTHUB_SKU == "F1":
free_iot_name, free_iot_rg = azure_cli.get_free_iothub()
if free_iot_name:
output.info("You already have a Free IoT Hub SKU in your subscription, so you must either use that existing IoT Hub or create an S1. Enter (1) to use the existing Free IoT Hub, Enter (S1) to create a new S1 IoT Hub")
output.info("You already have a Free IoT Hub SKU in your subscription, so you must either use that existing IoT Hub or create a new S1 IoT Hub. Enter (F) to use the existing Free IoT Hub or enter (S) to create a new S1 IoT Hub")
user_response = sys.stdin.readline().strip().upper()
if user_response == "S1":
if user_response == "S":
envvars.IOTHUB_SKU = "S1"
elif user_response == "1":
elif user_response == "F":
envvars.IOTHUB_NAME = free_iot_name
envvars.RESOURCE_GROUP_NAME = free_iot_rg
return free_iot_name
@ -174,6 +174,7 @@ def list_subscriptions_and_set_default():
# first verify that we have an existing auth token in cache, otherwise login using interactive
if not default_subscriptionId:
default_subscriptionId = azure_cli.user_has_logged_in()
if not default_subscriptionId and not azure_cli.login_interactive():
sys.exit()
@ -188,7 +189,7 @@ def list_subscriptions_and_set_default():
'--setup',
required=True,
is_flag=True,
help="Reads the required Azure resources configuration from your subscription. Creates new Azure resources or uses existing ones.")
help="Reads the required Azure resources configuration from your subscription. Creates new Azure resources or uses an existing one.")
@click.option(
'--credentials',
required=False,