
import sys

import pythoncom
sys.coinit_flags = pythoncom.COINIT_MULTITHREADED
pythoncom.CoInitializeEx(pythoncom.COINIT_MULTITHREADED)

from oslo_config import cfg
from oslo_log import log as oslo_logging

from cloudbaseinit import init
from cloudbaseinit.utils import log as logging

CONF = cfg.CONF

LOG = oslo_logging.getLogger(__name__)


def main():
    CONF(sys.argv[1:])
    logging.setup('cloudbaseinit')

    try:
        init.InitManager().configure_host()
    except Exception as exc:
        LOG.exception(exc)
        raise


if __name__ == "__main__":
    main()


import struct
import sys

if struct.calcsize("P") == 8 and sys.platform == 'win32':
    # This is needed by Nano Server.
    # Set COINIT_MULTITHREADED only on x64 interpreters due to issues on x86.
    import pythoncom
    sys.coinit_flags = pythoncom.COINIT_MULTITHREADED
    pythoncom.CoInitializeEx(pythoncom.COINIT_MULTITHREADED)

from oslo_config import cfg
from oslo_log import log as oslo_logging

from cloudbaseinit import init
from cloudbaseinit.utils import log as logging

CONF = cfg.CONF

LOG = oslo_logging.getLogger(__name__)


def main():
    CONF(sys.argv[1:])
    logging.setup('cloudbaseinit')

    try:
        init.InitManager().configure_host()
    except Exception as exc:
        LOG.exception(exc)
        raise


if __name__ == "__main__":
    main()

Make the multithreaded coinitialize only on 64bit
Make the multithreaded coinitialize only on 64bit

Change-Id: I5d44efb634051f00cd3ca54b99ce0dea806543be

  
+ import struct
  import sys
  
+ if struct.calcsize("P") == 8 and sys.platform == 'win32':
+     # This is needed by Nano Server.
+     # Set COINIT_MULTITHREADED only on x64 interpreters due to issues on x86.
- import pythoncom
+     import pythoncom
- sys.coinit_flags = pythoncom.COINIT_MULTITHREADED
+     sys.coinit_flags = pythoncom.COINIT_MULTITHREADED
- pythoncom.CoInitializeEx(pythoncom.COINIT_MULTITHREADED)
+     pythoncom.CoInitializeEx(pythoncom.COINIT_MULTITHREADED)
  
  from oslo_config import cfg
  from oslo_log import log as oslo_logging
  
  from cloudbaseinit import init
  from cloudbaseinit.utils import log as logging
  
  CONF = cfg.CONF
  
  LOG = oslo_logging.getLogger(__name__)
  
  
  def main():
      CONF(sys.argv[1:])
      logging.setup('cloudbaseinit')
  
      try:
          init.InitManager().configure_host()
      except Exception as exc:
          LOG.exception(exc)
          raise
  
  
  if __name__ == "__main__":
      main()
  
Make the multithreaded coinitialize only on 64bit
## Code Before:

import sys

import pythoncom
sys.coinit_flags = pythoncom.COINIT_MULTITHREADED
pythoncom.CoInitializeEx(pythoncom.COINIT_MULTITHREADED)

from oslo_config import cfg
from oslo_log import log as oslo_logging

from cloudbaseinit import init
from cloudbaseinit.utils import log as logging

CONF = cfg.CONF

LOG = oslo_logging.getLogger(__name__)


def main():
    CONF(sys.argv[1:])
    logging.setup('cloudbaseinit')

    try:
        init.InitManager().configure_host()
    except Exception as exc:
        LOG.exception(exc)
        raise


if __name__ == "__main__":
    main()

## Instruction:
Make the multithreaded coinitialize only on 64bit
## Code After:

import struct
import sys

if struct.calcsize("P") == 8 and sys.platform == 'win32':
    # This is needed by Nano Server.
    # Set COINIT_MULTITHREADED only on x64 interpreters due to issues on x86.
    import pythoncom
    sys.coinit_flags = pythoncom.COINIT_MULTITHREADED
    pythoncom.CoInitializeEx(pythoncom.COINIT_MULTITHREADED)

from oslo_config import cfg
from oslo_log import log as oslo_logging

from cloudbaseinit import init
from cloudbaseinit.utils import log as logging

CONF = cfg.CONF

LOG = oslo_logging.getLogger(__name__)


def main():
    CONF(sys.argv[1:])
    logging.setup('cloudbaseinit')

    try:
        init.InitManager().configure_host()
    except Exception as exc:
        LOG.exception(exc)
        raise


if __name__ == "__main__":
    main()
