@@ -12,7 +12,7 @@ module Puppet::Parser::Functions
12
12
flags << '--detach'
13
13
end
14
14
15
- if opts [ 'service_name' ] . to_s != 'undef'
15
+ if opts [ 'service_name' ] && opts [ 'service_name' ] . to_s != 'undef'
16
16
flags << "'#{ opts [ 'service_name' ] } '"
17
17
end
18
18
@@ -28,23 +28,23 @@ module Puppet::Parser::Functions
28
28
end
29
29
end
30
30
31
- if opts [ 'publish' ] . to_s != 'undef'
31
+ if opts [ 'publish' ] && opts [ 'publish' ] . to_s != 'undef'
32
32
flags << "--publish '#{ opts [ 'publish' ] } '"
33
33
end
34
34
35
- if opts [ 'replicas' ] . to_s != 'undef'
35
+ if opts [ 'replicas' ] && opts [ 'replicas' ] . to_s != 'undef'
36
36
flags << "--replicas '#{ opts [ 'replicas' ] } '"
37
37
end
38
38
39
39
if opts [ 'tty' ] . to_s != 'false'
40
40
flags << '--tty'
41
41
end
42
42
43
- if opts [ 'user' ] . to_s != 'undef'
43
+ if opts [ 'user' ] && opts [ 'user' ] . to_s != 'undef'
44
44
flags << "--user '#{ opts [ 'publish' ] } '"
45
45
end
46
46
47
- if opts [ 'workdir' ] . to_s != 'undef'
47
+ if opts [ 'workdir' ] && opts [ 'workdir' ] . to_s != 'undef'
48
48
flags << "--workdir '#{ opts [ 'workdir' ] } '"
49
49
end
50
50
@@ -54,19 +54,19 @@ module Puppet::Parser::Functions
54
54
end
55
55
end
56
56
57
- if opts [ 'host_socket' ] . to_s != 'undef'
57
+ if opts [ 'host_socket' ] && opts [ 'host_socket' ] . to_s != 'undef'
58
58
flags << "-H '#{ opts [ 'host_socket' ] } '"
59
59
end
60
60
61
- if opts [ 'registry_mirror' ] . to_s != 'undef'
61
+ if opts [ 'registry_mirror' ] && opts [ 'registry_mirror' ] . to_s != 'undef'
62
62
flags << "--registry-mirror='#{ opts [ 'registry_mirror' ] } '"
63
63
end
64
64
65
- if opts [ 'image' ] . to_s != 'undef'
65
+ if opts [ 'image' ] && opts [ 'image' ] . to_s != 'undef'
66
66
flags << "'#{ opts [ 'image' ] } '"
67
67
end
68
68
69
- if opts [ 'command' ] . to_s != 'undef'
69
+ if opts [ 'command' ] && opts [ 'command' ] . to_s != 'undef'
70
70
flags << opts [ 'command' ] . to_s
71
71
end
72
72
0 commit comments