Commit 0db34f31 by Csók Tamás

client: HKCU instead of HKLM and error corrections

parent 5c10fbda
...@@ -211,7 +211,7 @@ SectionGroup /e '!$(NAME_Install)' ...@@ -211,7 +211,7 @@ SectionGroup /e '!$(NAME_Install)'
;Initialize Running Directory ;Initialize Running Directory
ClearErrors ClearErrors
ReadRegStr $running_directory HKLM "Software\${Company} ${AppName}" "running_directory" ReadRegStr $running_directory HKCU "Software\${Company} ${AppName}" "running_directory"
${If} ${Errors} ${If} ${Errors}
StrCpy $running_directory ${DefaulLocation} StrCpy $running_directory ${DefaulLocation}
ClearErrors ClearErrors
...@@ -219,7 +219,7 @@ SectionGroup /e '!$(NAME_Install)' ...@@ -219,7 +219,7 @@ SectionGroup /e '!$(NAME_Install)'
;Store installation folder ;Store installation folder
WriteRegStr HKLM "Software\${Company} ${AppName}" "install_directory" $INSTDIR WriteRegStr HKLM "Software\${Company} ${AppName}" "install_directory" $INSTDIR
WriteRegStr HKLM "Software\${Company} ${AppName}" "running_directory" $running_directory WriteRegStr HKCU "Software\${Company} ${AppName}" "running_directory" $running_directory
;Create uninstaller ;Create uninstaller
WriteUninstaller "$INSTDIR\${AppUninstaller}" WriteUninstaller "$INSTDIR\${AppUninstaller}"
...@@ -861,7 +861,7 @@ FunctionEnd ...@@ -861,7 +861,7 @@ FunctionEnd
;Uninstaller Section ;Uninstaller Section
Section "Uninstall" Section "Uninstall"
ClearErrors ClearErrors
ReadRegStr $running_directory HKLM "Software\${Company} ${AppName}" "running_directory" ReadRegStr $running_directory HKCU "Software\${Company} ${AppName}" "running_directory"
${If} ${Errors} ${If} ${Errors}
StrCpy $running_directory ${DefaulLocation} StrCpy $running_directory ${DefaulLocation}
ClearErrors ClearErrors
......
...@@ -37,7 +37,7 @@ def parse_arguments(): ...@@ -37,7 +37,7 @@ def parse_arguments():
""" """
parser = argparse.ArgumentParser() parser = argparse.ArgumentParser()
parser.add_argument( parser.add_argument(
"uri", type=str, help="Specific schema handler", nargs='?', "uri", type=unicode, help="Specific schema handler", nargs='?',
default=None) default=None)
parser.add_argument( parser.add_argument(
"-l", "--loglevel", "-l", "--loglevel",
...@@ -47,7 +47,7 @@ def parse_arguments(): ...@@ -47,7 +47,7 @@ def parse_arguments():
parser.add_argument( parser.add_argument(
"-f", "--logfile", "-f", "--logfile",
help="Explicit location of the wanted logfile location and name", help="Explicit location of the wanted logfile location and name",
type=str, type=unicode,
default=("%(directory)s\\%(file)s" % { default=("%(directory)s\\%(file)s" % {
'directory': ClientRegistry.directory(), 'directory': ClientRegistry.directory(),
'file': 'client.log'})) 'file': 'client.log'}))
...@@ -70,10 +70,17 @@ def main(): ...@@ -70,10 +70,17 @@ def main():
try: try:
if args.uri is not None: if args.uri is not None:
logger.info('Received the following URI: %s', args.uri)
vm = Struct() vm = Struct()
x, vm.protocol, vm.user, vm.password, vm.host, vm.port = \ x, vm.protocol, vm.user, vm.password, vm.host, vm.port = \
args.uri.split(':', 5) args.uri.split(':', 5)
logger.info(("Received the following URI: %(handler)s:"
"%(protocol)s:%(user)s:password:%(host)s:%(port)s" % {
'handler': x,
'protocol': vm.protocol,
'user': vm.user,
'host': vm.host,
'port': vm.port
}))
vm.protocol = vm.protocol.upper() vm.protocol = vm.protocol.upper()
logger.debug("The Client split it followingly: protocol -> %s | " logger.debug("The Client split it followingly: protocol -> %s | "
"user -> %s | password -> %s | " "user -> %s | password -> %s | "
......
...@@ -31,9 +31,9 @@ def connect(vm): ...@@ -31,9 +31,9 @@ def connect(vm):
vm.password -- Password used for the connection vm.password -- Password used for the connection
""" """
logger = logging.getLogger() logger = logging.getLogger()
logger.info('Connect methods started') logger.debug('Connect methods started')
if vm.protocol == "SSH": if vm.protocol == "SSH":
logger.debug('SSH protocol received') logger.info('SSH protocol received')
arguments = ("-ssh -P %(port)s -pw %(password)s" arguments = ("-ssh -P %(port)s -pw %(password)s"
" %(user)s@%(host)s" % { " %(user)s@%(host)s" % {
'port': vm.port, 'port': vm.port,
...@@ -41,13 +41,13 @@ def connect(vm): ...@@ -41,13 +41,13 @@ def connect(vm):
'user': vm.user, 'user': vm.user,
'host': vm.host}) 'host': vm.host})
directory = os.path.dirname(os.path.abspath(__file__)) directory = os.path.dirname(os.path.abspath(__file__))
logger.debug('Popen: "%s\\putty.exe"', directory) logger.info('Popen: "%s\\putty.exe"', directory)
logger.info('Determined arguments: %s', arguments) logger.debug('Determined arguments: %s', arguments)
subprocess.Popen('"%(path)s\\putty.exe" %(arguments)s' % { subprocess.Popen('"%(path)s\\putty.exe" %(arguments)s' % {
'path': directory, 'path': directory,
'arguments': arguments}, shell=True) 'arguments': arguments}, shell=True)
elif vm.protocol == "NX": elif vm.protocol == "NX":
logger.debug('NX protocol received') logger.info('NX protocol received')
listdir = os.path.expanduser("~\\.nx\\config\\*.nxs") listdir = os.path.expanduser("~\\.nx\\config\\*.nxs")
found = False found = False
server = "\"Server host\" value=\"%s\"" % vm.host server = "\"Server host\" value=\"%s\"" % vm.host
...@@ -73,7 +73,7 @@ def connect(vm): ...@@ -73,7 +73,7 @@ def connect(vm):
logger.debug('Popen the config file: %s', config_file) logger.debug('Popen the config file: %s', config_file)
subprocess.Popen('"%s"' % config_file, shell=True) subprocess.Popen('"%s"' % config_file, shell=True)
elif vm.protocol == "RDP": elif vm.protocol == "RDP":
logger.debug('NX protocol received') logger.info('RDP protocol received')
listdir = ClientRegistry.directory() + "\\.rdp\\*.rdp" listdir = ClientRegistry.directory() + "\\.rdp\\*.rdp"
found = False found = False
full_address = "full address:s:%s:%s" % (vm.host, vm.port) full_address = "full address:s:%s:%s" % (vm.host, vm.port)
......
...@@ -38,7 +38,7 @@ def parse_arguments(): ...@@ -38,7 +38,7 @@ def parse_arguments():
local_default = os.environ['APPDATA'] + "\\CIRCLE\\" local_default = os.environ['APPDATA'] + "\\CIRCLE\\"
parser.add_argument( parser.add_argument(
"-l", "--location", help="Location of the client files in the system", "-l", "--location", help="Location of the client files in the system",
default=local_default, required=False) type=unicode, default=local_default, required=False)
parser.add_argument( parser.add_argument(
"-r", "--remove", "-r", "--remove",
help="Remove installed files instead of creating them", help="Remove installed files instead of creating them",
...@@ -50,7 +50,7 @@ def parse_arguments(): ...@@ -50,7 +50,7 @@ def parse_arguments():
parser.add_argument( parser.add_argument(
"-t", "--target", "-t", "--target",
help="If this is an URL icon, where should it point", help="If this is an URL icon, where should it point",
default="https://cloud.bme.hu/", required=False) type=unicode, default="https://cloud.bme.hu/", required=False)
args = parser.parse_args() args = parser.parse_args()
return args return args
......
...@@ -57,7 +57,9 @@ class Struct: ...@@ -57,7 +57,9 @@ class Struct:
class ClientRegistry: class ClientRegistry:
@staticmethod @staticmethod
def directory(): def directory():
handler = RegistryHandler() custom_param = Struct()
custom_param.registry = "HKCU"
handler = RegistryHandler(custom_param)
directory = None directory = None
try: try:
directory = handler.get_key_value( directory = handler.get_key_value(
......
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