Commit b5b64fa0 by Guba Sándor

fix windows names

parent ee753180
import platform
from os.path import exists
""" This is the defautl context file. It replaces the Context class """ This is the defautl context file. It replaces the Context class
to the platform specific one. to the platform specific one.
""" """
import platform
from os.path import exists
from sys import path
# Add current directory to the import path
def _get_virtio_device(): def _get_virtio_device():
...@@ -26,7 +27,7 @@ def _get_virtio_device(): ...@@ -26,7 +27,7 @@ def _get_virtio_device():
def get_context(): def get_context():
system = platform.system() system = platform.system()
if system == "Windows": if system == "Windows":
from win32._win32context import Context from windows._win32context import Context
elif system == "Linux": elif system == "Linux":
from linux._linuxcontext import Context from linux._linuxcontext import Context
else: else:
...@@ -40,7 +41,7 @@ def get_serial(): ...@@ -40,7 +41,7 @@ def get_serial():
if system == 'Windows': if system == 'Windows':
port = _get_virtio_device() port = _get_virtio_device()
if port: if port:
from win32.win32virtio import SerialPort from windows.win32virtio import SerialPort
else: else:
from twisted.internet.serial import SerialPort from twisted.internet.serial import SerialPort
import pythoncom import pythoncom
......
import _win32context
import win32virtio
import network
\ No newline at end of file
...@@ -4,9 +4,10 @@ ...@@ -4,9 +4,10 @@
import platform import platform
system = platform.system() system = platform.system()
working_directory = "C:/agent" working_directory = r"C:\circle"
from os import environ, join from os import environ
from os.path import join
import logging import logging
import tarfile import tarfile
...@@ -97,7 +98,7 @@ class Context(BaseContext): ...@@ -97,7 +98,7 @@ class Context(BaseContext):
myfile.write(data) myfile.write(data)
@staticmethod @staticmethod
def _update_registry(cls, dir, executable): def _update_registry(dir, executable):
# HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\circle-agent # HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\circle-agent
from _winreg import (OpenKeyEx, SetValueEx, QueryValueEx, from _winreg import (OpenKeyEx, SetValueEx, QueryValueEx,
HKEY_LOCAL_MACHINE, KEY_ALL_ACCESS) HKEY_LOCAL_MACHINE, KEY_ALL_ACCESS)
......
...@@ -26,7 +26,7 @@ def get_interfaces_windows(interfaces): ...@@ -26,7 +26,7 @@ def get_interfaces_windows(interfaces):
yield nic, conf yield nic, conf
def change_ip(interfaces, dns): def change_ip_windows(interfaces, dns):
for nic, conf in get_interfaces_windows(interfaces): for nic, conf in get_interfaces_windows(interfaces):
link_local = IPNetwork('fe80::/16') link_local = IPNetwork('fe80::/16')
new_addrs = [IPNetwork(ip) for ip in conf['addresses']] new_addrs = [IPNetwork(ip) for ip in conf['addresses']]
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment